#16917 closed Bug (fixed)
Listing leftover content types for missing models breaks admin
| Reported by: | Ivan Sagalaev | Owned by: | Ivan Sagalaev |
|---|---|---|---|
| Component: | contrib.contenttypes | Version: | 1.3 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Ready for checkin | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
If during the lifecycle of the project some models got removed and their registered content types still remain in the DB the admin (or any such code for that matter) crashes trying to display content types. This happens due to ContenType.__unicode__ relying on self.model_class() to be always available. This is a recent regression from [16839].
Attachments (1)
Change History (6)
by , 14 years ago
| Attachment: | 16917.diff added |
|---|
comment:1 by , 14 years ago
| Has patch: | set |
|---|
comment:2 by , 14 years ago
| Triage Stage: | Unreviewed → Ready for checkin |
|---|
Thanks for catching this. Makes the idea of eventually deprecating the "name" field slightly trickier, though I guess we could still put together a reasonable unicode representation from the other fields. Doesn't matter too much what the unicode representation for a stale content type is.
comment:3 by , 14 years ago
Oh, I think anything like "(missing)" or even "---" will work. I used self.name only because right now it's a little bit more informative.
Patch