You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Where get_serializer_class() is used to determine which serializer would be used for a ModelViewSet, it doesn't re-create the same environment as DRF would use when servicing an actual API request, and so it may return different results (and thus incorrect documentation).
As an example, I have the following method, which uses a cut-down serializer for list actions, and a full-content serializer for retrieve actions:
drfdocs doesn't currently set the self.action member before calling get_serializer_class(), so it gets the default serializer with no fields, whereas an actual API request would get either the FooSerializer or the FooListSerializer.
The text was updated successfully, but these errors were encountered:
Where
get_serializer_class()
is used to determine which serializer would be used for aModelViewSet
, it doesn't re-create the same environment as DRF would use when servicing an actual API request, and so it may return different results (and thus incorrect documentation).As an example, I have the following method, which uses a cut-down serializer for list actions, and a full-content serializer for retrieve actions:
drfdocs doesn't currently set the
self.action
member before callingget_serializer_class()
, so it gets the default serializer with no fields, whereas an actual API request would get either theFooSerializer
or theFooListSerializer
.The text was updated successfully, but these errors were encountered: