Opened 17 years ago
Last modified 13 years ago
#6755 closed
Model Inheritance doesn't work in the admin. — at Version 5
Reported by: | anonymous | Owned by: | nobody |
---|---|---|---|
Component: | contrib.admin | Version: | dev |
Severity: | Keywords: | ||
Cc: | evh293@…, newijk@…, erwin@…, robillard.etienne@…, ekellner@…, someone@…, philipp@…, cmawebsite@…, wonlay@…, brooks.travis@…, jamespic@…, mateusz@… | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
Under QS-RF, inherited models don't work in the admin. See Malcolm's message: http://groups.google.com/group/django-developers/msg/c0fb00dabb70c660
Change History (5)
comment:1 by , 17 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:2 by , 17 years ago
Resolution: | invalid |
---|---|
Status: | closed → reopened |
Sorry, I hope that this comment helps you to reproduce the behaviour that I think that is a bug.
Reproducing de bug
- Suppose a django app with this model:
class Place(models.Model): name = models.CharField(max_length=50) address = models.CharField(max_length=80) def __unicode__(self): return u"%s the place" % self.name class Admin: pass class Restaurant(Place): serves_hot_dogs = models.BooleanField() serves_pizza = models.BooleanField() def __unicode__(self): return u"%s the restaurant" % self.name class Admin: pass
- Now, go to the admin site (<address to your app>/admin) and create a new Restaurant.
- Then, try edit the restaurant created in the previous step. Modify some field value and press "save". Now when go to the Restaurant list appears TWO restaurants: the save on tha previous step creates a new restaurant instead of edit the first.
NOTE
If define the primary key of the parent class(Place) explicitly the edition functionality works well:
class Place(models.Model): id = models.AutoField('id', primary_key=True, editable=False) name = models.CharField(max_length=50) address = models.CharField(max_length=80) def __unicode__(self): return u"%s the place" % self.name class Admin: pass class Restaurant(Place): serves_hot_dogs = models.BooleanField() serves_pizza = models.BooleanField() def __unicode__(self): return u"%s the restaurant" % self.name class Admin: pass
comment:3 by , 17 years ago
I believe this is a known problem. You are using queryset-refactor, model inheritance, and admin. Per Malcolm's note yesterday on the status of queryset-refactor:
http://groups.google.com/group/django-developers/msg/c0fb00dabb70c660
"model inheritance is not expected to work in admin at the moment".
comment:4 by , 17 years ago
Component: | Uncategorized → Admin interface |
---|
comment:5 by , 17 years ago
Description: | modified (diff) |
---|---|
Summary: | Admin site update error → Model Inheritance doesn't work in the admin. |
Triage Stage: | Unreviewed → Accepted |
As Karen said, MI doesn't yet work in the admin; updating the ticket to indicate that.
IMO, also, we could simply wait for newforms-admin to fix this; dunno how much that'll annoy people.
We're going to need a lot more information to be able to debug this one. Please read our guidelines for submitting bugs, and especially this:
Feel free to reopen with more info if you've got it.