K
K
Konstantin Malyarov2018-03-10 18:27:54
Django
Konstantin Malyarov, 2018-03-10 18:27:54

How to serialize two related models in Django?

There are two models Disaese_history and Patient. Every case history has a patient.
How to serialize the patient model when serializing a case history?

stories_department = serializers.serialize('json', Disaese_history.objects.filter(exit_day=None))

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Kitaev, 2018-03-10
@deliro

Use drf. It's there out of the box.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question