Tuesday, March 20, 2018

Re: serializtion

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.gatti@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-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/ace71c43-8c3a-45c8-8616-4e5c450d55b3%40googlegroups.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+unsubscribe@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/CAK4qSCdACXWsH9Lv1e813223npSVM-naioziGJNn0SQ2hFdLxg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment