Ah - so the way to provide additional detail for the serializer is to 
override get_serializer_context() in the ViewSet and have it return the 
default context plus the additional custom detail - correct?

On Monday, 3 October 2016 07:56:31 UTC+1, Xavier Ordoquy wrote:
>
> Hi,
>
> Sure, that's the view passed within the serializer's context.
>
> Regards,
> Xavier
> Linovia
>
> Envoyé de mon iPhone
>
> Le 3 oct. 2016 à 00:24, 'AJ Ostergaard' via Django REST framework <
> [email protected] <javascript:>> a écrit :
>
> Are ViewSet instances available from Serializers?
>
> On 2 Oct 2016 20:24, "Kevin Brown" <[email protected] <javascript:>> 
> wrote:
>
>> 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 <
>> [email protected] <javascript:>> wrote:
>>
>>> Is there a way to add serializer context when using viewsets? I'm 
>>> referring to the functionality discussed here 
>>> <http://www.django-rest-framework.org/api-guide/serializers/#including-extra-context>
>>>  
>>> 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 [email protected] 
>>> <javascript:>.
>>> 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 
>> [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
> -- 
> 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 [email protected] <javascript:>.
> For more options, visit https://groups.google.com/d/optout.
>
>

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to