Skip to content

Commit b4ea18c

Browse files
authored
Merge pull request django-haystack#1642 from timgraham/django13
Remove compatibility shims for Django < 1.4
2 parents 6c4a854 + f6f3f4e commit b4ea18c

File tree

1 file changed

+2
-23
lines changed

1 file changed

+2
-23
lines changed

haystack/admin.py

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,6 @@
1515
from haystack.utils import get_model_ct_tuple
1616

1717

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-
3318
class SearchChangeList(ChangeList):
3419
def __init__(self, **kwargs):
3520
self.haystack_connection = kwargs.pop("haystack_connection", "default")
@@ -54,7 +39,7 @@ def get_results(self, request):
5439
SearchQuerySet(self.haystack_connection).models(self.model).all().count()
5540
)
5641

57-
can_show_all = result_count <= list_max_show_all(self)
42+
can_show_all = result_count <= self.list_max_show_all
5843
multi_page = result_count > self.list_per_page
5944

6045
# Get the list of objects to display on this page.
@@ -120,13 +105,9 @@ def changelist_view(self, request, extra_context=None):
120105
"list_select_related": self.list_select_related,
121106
"list_per_page": self.list_per_page,
122107
"list_editable": self.list_editable,
108+
"list_max_show_all": self.list_max_show_all,
123109
"model_admin": self,
124110
}
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-
130111
changelist = SearchChangeList(**kwargs)
131112
changelist.formset = None
132113
media = self.media
@@ -161,8 +142,6 @@ def changelist_view(self, request, extra_context=None):
161142
"cl": changelist,
162143
"media": media,
163144
"has_add_permission": self.has_add_permission(request),
164-
# More Django 1.4 compatibility
165-
"root_path": getattr(self.admin_site, "root_path", None),
166145
"app_label": self.model._meta.app_label,
167146
"action_form": action_form,
168147
"actions_on_top": self.actions_on_top,

0 commit comments

Comments
 (0)