ViewSet instances should have a get_serializer_context(self) method which they inherit from the generic API views. Remember that ViewSet instances are generic API views using mixins with a little extra added on top for routing purposes.
Is there a way to add serializer context when using viewsets? I'm referring to the functionality discussed here which is difficult to implement in a viewset where only the serializer class is defined. Could obviously be done by overriding all the methods but that would kinda miss the point of viewsets.
--
You received this message because you are subscribed to the Google Groups "Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-rest-fram...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Are ViewSet instances available from Serializers?
ViewSet instances should have a get_serializer_context(self) method which they inherit from the generic API views. Remember that ViewSet instances are generic API views using mixins with a little extra added on top for routing purposes.
On Sun, Oct 2, 2016, 13:52 'AJ Ostergaard' via Django REST framework <django-rest-framework@googlegroups.com> wrote:
Is there a way to add serializer context when using viewsets? I'm referring to the functionality discussed here which is difficult to implement in a viewset where only the serializer class is defined. Could obviously be done by overriding all the methods but that would kinda miss the point of viewsets.--
You received this message because you are subscribed to the Google Groups "Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-rest-framework+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "Django REST framework" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-rest-framework/e0d6Jzkl1_o/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-rest-framework+unsub...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to django-rest-fram...@googlegroups.com.