serializtion

20 views
Skip to first unread message

siva.gatti

unread,
Mar 20, 2018, 8:05:23 AM3/20/18
to Django users
I am new to Django rest framework and don't know how to make two models into one serializer 

Andréas Kühne

unread,
Mar 20, 2018, 8:45:31 AM3/20/18
to django...@googlegroups.com
Hi Siva,


If you want to nest the relationship, for example: 
One author has many books. 

You will need to write your own update / create code then though.

If you just want to add 2 models into one serializer without an internal relationship, you will need to add fields for each property on the model and then add the models individually:

Regards,

Andréas

2018-03-20 10:28 GMT+01:00 siva.gatti <siva....@gmail.com>:
I am new to Django rest framework and don't know how to make two models into one 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+unsubscribe@googlegroups.com.
To post to this group, send email to django...@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/ace71c43-8c3a-45c8-8616-4e5c450d55b3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages