In the Django Admin I want to use data from the current record to populate fields for a foreign key record when I click the add (+) button next to the drop-down list.
For example, I am viewing an instance of X
which has fields for a
, b
, and c
and a foreign key Y
.
Y
also has fields for a
, b
, and c
, so when I click on the "add" button on the X
instance, I want the a
, b
, and c
fields for the new Y
instance to be populated with the values from the X
instance.
Obviously these fields would not be pre-populated if I just go to "add new Y" in the admin!
I have searched quite a bit to no avail!
Anyone had any success?
(I'm using django 1.3 with Python 2.6; I don't think any code snippets are required here.)