Code

Ticket #4222: changelist_override.diff

File changelist_override.diff, 881 bytes (added by Øyvind Saltvik <oyvind@…>, 7 years ago)

proposed patch

Line 
1Index: django/contrib/admin/options.py
2===================================================================
3--- django/contrib/admin/options.py     (revision 5149)
4+++ django/contrib/admin/options.py     (working copy)
5@@ -113,6 +113,7 @@
6     prepopulated_fields = {}
7     filter_vertical = ()
8     filter_horizontal = ()
9+    changelist = None
10 
11     def __init__(self, model):
12         self.model = model
13@@ -476,7 +477,8 @@
14 
15     def changelist_view(self, request):
16         "The 'change list' admin view for this model."
17-        from django.contrib.admin.views.main import ChangeList, ERROR_FLAG
18+        from django.contrib.admin.views.main import ChangeList as default_changelist, ERROR_FLAG
19+        ChangeList = self.changelist or default_changelist
20         opts = self.model._meta
21         app_label = opts.app_label
22         if not self.has_change_permission(request, None):