Patch a field

19 views
Skip to first unread message

Paul Mwenimpako Siame

unread,
May 26, 2016, 4:19:06 PM5/26/16
to Django REST framework
How do I patch a specific feild in DRF? your tutorials and API are confusing m and the example code doesn't work.. I have a product model and I want to update the number of likes it get by sending a JSON request and then update only the likes field of my model from the sent JSON, so how do I do that?

Xavier Ordoquy

unread,
May 27, 2016, 2:44:14 AM5/27/16
to django-res...@googlegroups.com
Hi,

> Le 26 mai 2016 à 22:19, Paul Mwenimpako Siame <pauls...@gmail.com> a écrit :
>
> How do I patch a specific feild in DRF?

This is a bit vague.
You mean you want to sent a PATCH request to DRF and update a single field ?

> your tutorials and API are confusing m and the example code doesn't work..

You need to be more specific about what you didn’t understand and what doesn’t work.
Otherwise, we’ll assume you’re doing something wrong but can’t guess what.

> I have a product model and I want to update the number of likes it get by sending a JSON request and then update only the likes field of my model from the sent JSON, so how do I do that?

Do you use ViewSets and routers or simple APIView ?

Regards,
Xavier,
Linovia.

Paul Mwenimpako Siame

unread,
May 31, 2016, 3:40:50 PM5/31/16
to django-res...@googlegroups.com
I have simple apiview, I am trying to deserialize a JSON request from my mobile app and patch a single field (increasing the number of likes on a product model for my shopping app). I have actually come to the extent of just copying and pasting your tutorial code and modifying it to fit my context of use (changing variable names and declaring permission classes) but I still just get an error 400 when I try to like a product.. I have a Stackoverflow on it if that could help, my code is there.. am I allowed to post links here?

--
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/vTwmoiLRlD8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-rest-fram...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--

Paul Mwenimpako Siame

about.me/paulsiame

Felipe Rodrigues

unread,
Jun 1, 2016, 9:32:44 PM6/1/16
to django-res...@googlegroups.com
please, do send the code or the link

--
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-fram...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages