Discussion:
Dynamically change nested field queryset
Sassan Haradji
2018-03-23 22:48:23 UTC
Permalink
Is it possible to dynamically change queryset of a nested field based on
request.user for example? It is possible for PrimaryKeyRelatedField by
changing queryset attribute of the field in serializer's __init__, I need
the same for a nested field.
I know how to do it with MethodFields, but I want it to be writable.
--
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.
q***@qq.com
2018-09-15 18:23:10 UTC
Permalink
Hi, I encountered the same situation, do you know how to deal with it?

圚 2018幎3月24日星期六 UTC+8䞊午6:48:23Sassan Haradji写道
Post by Sassan Haradji
Is it possible to dynamically change queryset of a nested field based on
request.user for example? It is possible for PrimaryKeyRelatedField by
changing queryset attribute of the field in serializer's __init__, I need
the same for a nested field.
I know how to do it with MethodFields, but I want it to be writable.
--
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...