[Django] #25688: admin.register shouldn't allow an empty list of models to be registered

6 views
Skip to first unread message

Django

unread,
Nov 6, 2015, 8:28:59 AM11/6/15
to django-...@googlegroups.com
#25688: admin.register shouldn't allow an empty list of models to be registered
------------------------------------------------+------------------------
Reporter: bmispelon | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: contrib.admin | Version: 1.8
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
------------------------------------------------+------------------------
I couldn't remember how to do the model registering using the decorator
syntax and ended up with this code:

{{{#!python
@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.

--
Ticket URL: <https://code.djangoproject.com/ticket/25688>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Nov 6, 2015, 9:18:01 AM11/6/15
to django-...@googlegroups.com
#25688: admin.register shouldn't allow an empty list of models to be registered
--------------------------------------+------------------------------------

Reporter: bmispelon | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: contrib.admin | Version: 1.8
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by charettes):

* stage: Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/25688#comment:1>

Django

unread,
Nov 6, 2015, 11:32:57 AM11/6/15
to django-...@googlegroups.com
#25688: admin.register shouldn't allow an empty list of models to be registered
-------------------------------------+-------------------------------------
Reporter: bmispelon | Owner: hramezani
Type: | Status: assigned
Cleanup/optimization |
Component: contrib.admin | Version: 1.8

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by hramezani):

* owner: nobody => hramezani
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/25688#comment:2>

Django

unread,
Nov 6, 2015, 11:58:46 AM11/6/15
to django-...@googlegroups.com
#25688: admin.register shouldn't allow an empty list of models to be registered
-------------------------------------+-------------------------------------
Reporter: bmispelon | Owner: hramezani
Type: | Status: assigned
Cleanup/optimization |
Component: contrib.admin | Version: 1.8

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by hramezani):

* has_patch: 0 => 1


Comment:

[https://github.com/django/django/pull/5563 Pull Request]

--
Ticket URL: <https://code.djangoproject.com/ticket/25688#comment:3>

Django

unread,
Nov 6, 2015, 2:05:44 PM11/6/15
to django-...@googlegroups.com
#25688: admin.register shouldn't allow an empty list of models to be registered
-------------------------------------+-------------------------------------
Reporter: bmispelon | Owner: hramezani
Type: | Status: assigned
Cleanup/optimization |
Component: contrib.admin | Version: master

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by claudep):

* version: 1.8 => master
* needs_tests: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/25688#comment:4>

Django

unread,
Nov 7, 2015, 6:15:07 AM11/7/15
to django-...@googlegroups.com
#25688: admin.register shouldn't allow an empty list of models to be registered
-------------------------------------+-------------------------------------
Reporter: bmispelon | Owner: hramezani
Type: | Status: assigned
Cleanup/optimization |
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by aaronelliotross):

* Attachment "empty_list_fails_to_register.diff" added.

Adds a test and applies requested fixes to comments.

Django

unread,
Nov 7, 2015, 6:17:34 AM11/7/15
to django-...@googlegroups.com
#25688: admin.register shouldn't allow an empty list of models to be registered
-------------------------------------+-------------------------------------
Reporter: bmispelon | Owner: hramezani
Type: | Status: assigned
Cleanup/optimization |
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by aaronelliotross):

* cc: aaronelliotross@… (added)
* needs_tests: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/25688#comment:5>

Django

unread,
Nov 11, 2015, 8:41:46 AM11/11/15
to django-...@googlegroups.com
#25688: admin.register shouldn't allow an empty list of models to be registered
-------------------------------------+-------------------------------------
Reporter: bmispelon | Owner: hramezani
Type: | Status: assigned
Cleanup/optimization |
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/25688#comment:6>

Django

unread,
Nov 12, 2015, 9:55:18 AM11/12/15
to django-...@googlegroups.com
#25688: admin.register shouldn't allow an empty list of models to be registered
-------------------------------------+-------------------------------------
Reporter: bmispelon | Owner: hramezani
Type: | Status: closed

Cleanup/optimization |
Component: contrib.admin | Version: master
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"8c553e7d3fd3f598a445f3c35711829e9b3645a4" 8c553e7d]:
{{{
#!CommitTicketReference repository=""
revision="8c553e7d3fd3f598a445f3c35711829e9b3645a4"
Fixed #25688 -- Made admin.register() disallow an empty list of models.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/25688#comment:7>

Reply all
Reply to author
Forward
0 new messages