Discussion:
Content negotiation vs serializer
Ola
2018-08-27 19:32:24 UTC
Permalink
Hello,

I have a usecase where I need to implement different serializers for
different format. settings.py have a list of different
DEFAULT_RENDERER_CLASSES and PARSERS. I would like to take adventage of
HyperlinkedIdentityField in some of the serializers but not all. What is
the best way to do it?

A.
--
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Thế Bùi Công
2018-08-28 04:25:07 UTC
Permalink
u can review this:
https://stackoverflow.com/questions/40747927/how-to-write-a-custom-serializer
Post by Ola
Hello,
I have a usecase where I need to implement different serializers for
different format. settings.py have a list of different
DEFAULT_RENDERER_CLASSES and PARSERS. I would like to take adventage of
HyperlinkedIdentityField in some of the serializers but not all. What is
the best way to do it?
A.
--
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
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 django-rest-framework+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Carlton Gibson
2018-08-28 07:16:16 UTC
Permalink
I have a usecase where I need to implement different serializers for different format.
In `get_serializer()` or `get_serializer_class()` inspect the format and act appropriately.
--
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Ola
2018-08-28 09:43:57 UTC
Permalink
I agree to_presenation is to late to do it thanks for suggestions
--
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...