Filtering fields in http response data from http request url ?

22 views
Skip to first unread message

Adaeit Telle

unread,
May 30, 2021, 7:26:55 PM5/30/21
to Django users
Hi Django Developers,
Json response from the django server is huge as the data fields contained are of big size.
So, can I restrict the *fields* required in the response data from the *HTTP Request Url* ?
Is there a generic param, which can be used ?

Just like QuerySet, can we have "ValueSet" to restrict the fields(or columns) in the json response data ?

Regards,
Adaeit

Mottaz Hegaze

unread,
May 30, 2021, 10:03:24 PM5/30/21
to Django users
Using Django Rest Framework , you can alter the output by overriting function to_represent in serializer.

--
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/f274b86b-e3fb-483b-802e-857362087619n%40googlegroups.com.

Sam Chaffy

unread,
May 31, 2021, 10:36:42 AM5/31/21
to django...@googlegroups.com
Using django rest framework, create a serializer class and specify the right field you want to display at the end. 

Please check this link


--
Oussama Chafiqui
Reply all
Reply to author
Forward
0 new messages