Opened 9 years ago
Closed 9 years ago
#25688 closed Cleanup/optimization (fixed)
admin.register shouldn't allow an empty list of models to be registered
Reported by: | Baptiste Mispelon | Owned by: | Hasan Ramezani |
---|---|---|---|
Component: | contrib.admin | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | aaronelliotross@… | Triage Stage: | Ready for checkin |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
I couldn't remember how to do the model registering using the decorator syntax and ended up with this code:
@admin.register() class MyModelAdmin(admin.ModelAdmin): pass
This code doesn't actually do anything, but it does so silently. I think register
should complain when you give it no actual model to register.
Attachments (1)
Change History (8)
comment:1 by , 9 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 9 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:3 by , 9 years ago
Has patch: | set |
---|
comment:4 by , 9 years ago
Needs tests: | set |
---|---|
Version: | 1.8 → master |
by , 9 years ago
Attachment: | empty_list_fails_to_register.diff added |
---|
Adds a test and applies requested fixes to comments.
comment:5 by , 9 years ago
Cc: | added |
---|---|
Needs tests: | unset |
comment:6 by , 9 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
Note:
See TracTickets
for help on using tickets.
Pull Request