Admin inline for inherited model cant find pointer to parent model

40 views
Skip to first unread message

Demetrio Girardi

unread,
Feb 13, 2012, 4:43:58 AM2/13/12
to django...@googlegroups.com
I have a child model that I wish edit inline in the admin site. When
trying to save edits I get a MultiValueDictKeyError:

"Key 'childmodel_set-0-parentmodel_ptr' not found in <QueryDict: ..>"

It seems to me the admin is trying to get the reference to the parent
model from the form data. How can I fix this? Do I need a custom form?

Demetrio Girardi

unread,
Feb 13, 2012, 5:44:46 AM2/13/12
to django...@googlegroups.com
Looking more into this,

my parent model has a primary key field named 'code'. The inline forms
do show the 'code' field for the child model instances, and the data
is in the formset's querydict:
QueryDict <... u'childmodel_set-0-code': [u'...'] ...>

However the table column name for the one-to-one relationship between
parent and child is called 'parendmodel__ptr__id', and the admin is
looking for 'childmodel_set-0-parentmodel_ptr' in the formset data.
Why?

Reply all
Reply to author
Forward
0 new messages