Задать вопрос

Тел: +7 965 3737 888

464

Просмотров

1

Ответов

Multiple models display form

You have an update form with many fields and want to populate it with data coming from multiple models.

Вопрос полезен? Да0/Нет0
file_2573.py(634.0б)
None

Ответы (1):

Ответmiracle2k:18.07.2007
Ответ полезен? Да0/Нет0

If you're models are related to each other via a Foreignkey, beware. They're (autoincremented) primary keys could in theory be out of sync. I had the same thing just happen to me.

You may want to consider doing something like this instead:

p = Property.objects.get(pk=object_id) h = HouseLet.objects.get(property=p.id)

Or differently, whatever your exact relationships are.