Hi,

It depends if the structure of the data you want to post is the same as the one 
your retrieve with a GET, and if it fits with the underlying model. In this 
case, the same serializer can be used for both operations. Pay attention 
however that things can be more complex if the involved model uses relations. 
In this case, using the same serializer is not always applicable.


If not possible, you'll need to define one for data retrieval (you can 
configure it so that all fields are read-only to be sure it will not be used 
incorrectly) and another one to model the data you'll send for a POST.


Eric

________________________________
From: django-users@googlegroups.com <django-users@googlegroups.com> on behalf 
of TimT Vogt <timtv...@gmail.com>
Sent: Wednesday, September 12, 2018 11:04:39 AM
To: django-users@googlegroups.com
Subject: Django restapi get post

Hi Group
I am making an Django backend to out data with a rest API to angular frontend.

The rest-API/ GET works😀.
The POST: do I ajust the current serializer?
Or do I need to create another serializer in ABN New app with a recieving model?

Verstuurd vanaf mijn iPhone

--
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/96859EB9-17EF-49C4-ADD6-3D912749FF5B%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/DB7P193MB0426614C49AF4D4ADFB005B18C1B0%40DB7P193MB0426.EURP193.PROD.OUTLOOK.COM.
For more options, visit https://groups.google.com/d/optout.

Reply via email to