#10271: Models with multiple inlines inheriting from the same parent class do 
not
save properly in admin
----------------------------------+-----------------------------------------
 Reporter:  idangazit             |       Owner:  nobody    
   Status:  new                   |   Milestone:            
Component:  django.contrib.admin  |     Version:  1.0       
 Keywords:                        |       Stage:  Unreviewed
Has_patch:  0                     |  
----------------------------------+-----------------------------------------
 I've attached a model graph and screenshots which illustrate the problem a
 lot more clearly than my words, but bear with me. I've tried my best to
 make it unconfusing. :)

 '''Basically, I can reproducibly make the admin issue incorrect INSERT
 statements when saving a model with inlines.'''

 I have a model with inlines of multiple classes (all of which inherit from
 a common parent). When I create a new instance of the model, it will use
 only the data from the LAST inline to create all of the model instances
 for ALL the inlines.

 For example: I have two models, !TwitterAccount and !DeliciousAccount,
 both of which inherit from Account. Both are displayed inline in the model
 admin for the Persona model. When creating a new persona, I enter data for
 a new !TwitterAccount and a new !DeliciousAccount on the add page for
 Persona. When I click save, I find that there are ('''correctly''') one
 new !TwitterAccount and one new !DeliciousAccount, but ('''incorrectly''')
 both new accounts are populated with the data I entered for the
 !DeliciousAccount.

 I've verified that this behavior only occurs for the pages with the
 inlines:
  * Model instance creation works as expected from `./manage.py shell`
  * Model instance creation works as expected if I create the instances
 one-by-one from a model-specific admin page and not via inlines

 Attached you'll find three PNGs:
  1. '''1_admin.png''': shows the admin add page for the model with the
 inlines. Note that the data entered for each inline is different.
  2. '''2_sql.png''': using the django-debug-toolbar, shows the SQL
 statements executed after clicking `Save`. Note that `delicious999` is the
 only data used when creating the inlined model instances. The twitter
 account is still created — but using the delicious account's data.
  3. '''model_graph.png''': shows the models in the application. The
 various accounts all inherit from Account, the various activities inherit
 from Activity.

 I'd love to help in fixing this bug but I could use some guidance on what
 to do next. Thank you!

-- 
Ticket URL: <http://code.djangoproject.com/ticket/10271>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to