Depend on a serializer context variable no_truncate

to decide whether to turn off the ANSI control sequence-aware
truncation, instead of needing inappropriate awareness of the details
of the view that invoked the serializer.  This will also allow us to
have views that can more flexibly turn off the truncation under other
circumstances.
This commit is contained in:
Jeff Bradberry
2019-10-10 16:08:17 -04:00
parent a803cedd7c
commit 9efa7b84df
2 changed files with 15 additions and 5 deletions

View File

@@ -3774,6 +3774,11 @@ class JobEventDetail(RetrieveAPIView):
model = models.JobEvent
serializer_class = serializers.JobEventSerializer
def get_serializer_context(self):
context = super().get_serializer_context()
context.update(no_truncate=True)
return context
class JobEventChildrenList(SubListAPIView):
@@ -4008,6 +4013,11 @@ class AdHocCommandEventDetail(RetrieveAPIView):
model = models.AdHocCommandEvent
serializer_class = serializers.AdHocCommandEventSerializer
def get_serializer_context(self):
context = super().get_serializer_context()
context.update(no_truncate=True)
return context
class BaseAdHocCommandEventsList(SubListAPIView):