Skip to content Skip to sidebar Skip to footer

Dynamically Modifying Serializer Fields In Django Rest Framework

I'm trying to use the Advanced serializer usage described in the django rest framework documentation. http://django-rest-framework.org/api-guide/serializers.html#advanced-serialize

Solution 1:

Note that you are setting serializer_class not to a class, but to an instance of the class. You either need to set dropfields as an attribute on the class, (just like it does for fields in the documented example you link to) or you need to look at overriding the get_serializer method of the viewset (docs).


Post a Comment for "Dynamically Modifying Serializer Fields In Django Rest Framework"