#29917: admin.E130 (__name__ uniqueness) regression
-----------------------------------------------+------------------------
               Reporter:  Matthias Kestenholz  |          Owner:  nobody
                   Type:  Bug                  |         Status:  new
              Component:  contrib.admin        |        Version:  master
               Severity:  Normal               |       Keywords:
           Triage Stage:  Unreviewed           |      Has patch:  0
    Needs documentation:  0                    |    Needs tests:  0
Patch needs improvement:  0                    |  Easy pickings:  0
                  UI/UX:  0                    |
-----------------------------------------------+------------------------
 **Short version:** The introduction of admin.E130 (<class
 'cabinet.admin.FileAdmin'>: (admin.E130) __name__ attributes of actions
 defined in <class 'cabinet.admin.FileAdmin'> must be unique.) makes it
 impossible to define `actions` on a base model admin class.

 **Longer explanation:**

 I have an admin base class which defines an `actions` attribute:
 https://github.com/matthiask/django-
 
cabinet/blob/38d8d4333057d1bb848db0bad88304b05ca3df02/cabinet/base_admin.py#L372

 The `actions` attribute isn't overridden in the model admin class which is
 actually used:
 https://github.com/matthiask/django-
 cabinet/blob/38d8d4333057d1bb848db0bad88304b05ca3df02/cabinet/admin.py#L11

 So when collecting `actions` from the MRO in ModelAdmin._get_base_actions
 
https://github.com/django/django/blob/5a2dd5ec5330938e9afb77faf6ca89abf39c018c/django/contrib/admin/options.py#L854
 the same `move_to_folder` string is added twice which leads to the
 following failure:
 https://travis-ci.org/matthiask/django-cabinet/jobs/450169887

 The actions dropdown in the administration interface only shows the
 `move_to_folder` action once (only tested with Django 2.1 and lower), so
 I'd assume that the uniqueness of actions is enforced later somewhere
 somehow and the check should probably be reworked to either only check the
 final result or to take the MRO into account.

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

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/052.33a57a7a9fe9ffde377fcb8a14d8c9e2%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to