Opened 14 years ago
Closed 14 years ago
#14639 closed (fixed)
admin.site.register() does not check if the model is abstract (gives weird error)
Reported by: | Diederik van der Boor | Owned by: | nobody |
---|---|---|---|
Component: | contrib.admin | Version: | dev |
Severity: | Keywords: | error-messages | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | yes | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
When an abstract model is registered with admin.site.register()
it produces the following error later on:
type object '...' has no attribute '_default_manager'
This error does not make much sense unless you're already have more intimate knowledge of the framework.
To ease the learning curve of new developers, I think it would make sense to check whether the model is abstract or not.
Attachments (1)
Change History (6)
comment:1 by , 14 years ago
comment:2 by , 14 years ago
Triage Stage: | Unreviewed → Accepted |
---|---|
Version: | 1.2 → SVN |
I can confirm that it outputs this error.
by , 14 years ago
Attachment: | 14639-admin-site-prevent-abstract-registration.patch added |
---|
Prevent registration of abstract models with AdminSite.register(). Includes regression test
comment:3 by , 14 years ago
Has patch: | set |
---|
comment:4 by , 14 years ago
Needs tests: | set |
---|
Note:
See TracTickets
for help on using tickets.
Addition: it produces even more weird errors in the admin_tools dashboard, when viewing a specific app:
which happens somewhere in the
contenttypes
framework: