Filtering serializermethodfield in DRF

211 views
Skip to first unread message

shreeh...@gmail.com

unread,
Feb 23, 2021, 11:44:58 PM2/23/21
to Django users
I have to filter my queryset based on a query param. I have to filter based on serializermethodfield. 
Any help would be appreciated.


Thank you

Kunal Solanke

unread,
Feb 23, 2021, 11:52:51 PM2/23/21
to django...@googlegroups.com
I don't the exact use case here, but you can pass context while passing data to specializer.And then use it inside creializer clas by self.context.
In this case you can pass query params to context

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/0a62f492-3a41-4692-9140-48dd23d7bdbbn%40googlegroups.com.

shreeh...@gmail.com

unread,
Feb 24, 2021, 4:43:05 AM2/24/21
to Django users
Okay, thanks for the help.
Reply all
Reply to author
Forward
0 new messages