15
15
from haystack .utils import get_model_ct_tuple
16
16
17
17
18
- def list_max_show_all (changelist ):
19
- """
20
- Returns the maximum amount of results a changelist can have for the
21
- "Show all" link to be displayed in a manner compatible with both Django
22
- 1.4 and 1.3. See Django ticket #15997 for details.
23
- """
24
- try :
25
- # This import is available in Django 1.3 and below
26
- from django .contrib .admin .views .main import MAX_SHOW_ALL_ALLOWED
27
-
28
- return MAX_SHOW_ALL_ALLOWED
29
- except ImportError :
30
- return changelist .list_max_show_all
31
-
32
-
33
18
class SearchChangeList (ChangeList ):
34
19
def __init__ (self , ** kwargs ):
35
20
self .haystack_connection = kwargs .pop ("haystack_connection" , "default" )
@@ -54,7 +39,7 @@ def get_results(self, request):
54
39
SearchQuerySet (self .haystack_connection ).models (self .model ).all ().count ()
55
40
)
56
41
57
- can_show_all = result_count <= list_max_show_all ( self )
42
+ can_show_all = result_count <= self . list_max_show_all
58
43
multi_page = result_count > self .list_per_page
59
44
60
45
# Get the list of objects to display on this page.
@@ -120,13 +105,9 @@ def changelist_view(self, request, extra_context=None):
120
105
"list_select_related" : self .list_select_related ,
121
106
"list_per_page" : self .list_per_page ,
122
107
"list_editable" : self .list_editable ,
108
+ "list_max_show_all" : self .list_max_show_all ,
123
109
"model_admin" : self ,
124
110
}
125
-
126
- # Django 1.4 compatibility.
127
- if hasattr (self , "list_max_show_all" ):
128
- kwargs ["list_max_show_all" ] = self .list_max_show_all
129
-
130
111
changelist = SearchChangeList (** kwargs )
131
112
changelist .formset = None
132
113
media = self .media
@@ -161,8 +142,6 @@ def changelist_view(self, request, extra_context=None):
161
142
"cl" : changelist ,
162
143
"media" : media ,
163
144
"has_add_permission" : self .has_add_permission (request ),
164
- # More Django 1.4 compatibility
165
- "root_path" : getattr (self .admin_site , "root_path" , None ),
166
145
"app_label" : self .model ._meta .app_label ,
167
146
"action_form" : action_form ,
168
147
"actions_on_top" : self .actions_on_top ,
0 commit comments