#29917: admin.E130 (__name__ uniqueness) regression
-------------------------------------+-------------------------------------
Reporter: Matthias Kestenholz | Owner: nobody
Type: Bug | Status: closed
Component: contrib.admin | Version: master
Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Matthias Kestenholz):
Here's a failing test:
{{{
diff --git a/tests/modeladmin/test_actions.py
b/tests/modeladmin/test_actions.py
index 17b3c324d2..41687329c4 100644
--- a/tests/modeladmin/test_actions.py
+++ b/tests/modeladmin/test_actions.py
@@ -55,3 +55,23 @@ class AdminActionsTests(TestCase):
mock_request.user = user
actions = ma.get_actions(mock_request)
self.assertEqual(list(actions.keys()), expected)
+
+ def test_actions_mro(self):
+ class MockRequest:
+ pass
+
+ class AdminBase(admin.ModelAdmin):
+ actions = ['custom_action']
+
+ def custom_action(modeladmin, request, queryset):
+ pass
+
+ class BandAdmin(AdminBase):
+ pass
+
+ ma = BandAdmin(Band, admin.AdminSite())
+ mock_request = MockRequest()
+ mock_request.GET = {}
+ mock_request.user = self.superuser
+ action_names = [a[1] for a in ma._get_base_actions()]
+ self.assertEqual(action_names, ['delete_selected',
'custom_action'])
}}}
Here's the failure:
{{{
FAIL: test_actions_mro (modeladmin.test_actions.AdminActionsTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/matthias/Projects/django/tests/modeladmin/test_actions.py",
line 77, in test_actions_mro
self.assertEqual(action_names, ['delete_selected', 'custom_action'])
AssertionError: Lists differ: ['delete_selected', 'custom_action',
'custom_action'] != ['delete_selected', 'custom_action']
}}}
See how the `custom_action` is added twice, once by `AdminBase.actions`
directly, and once by its inheritance in `BandAdmin`
--
Ticket URL: <https://code.djangoproject.com/ticket/29917#comment:8>
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/067.d56008f1afcd9a95e8e6cc347340ee5b%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.