Made admin generated changelist URLs independent of dict ordering
This commit is contained in:
parent
6b9f130278
commit
c31c2c92b8
|
@ -158,7 +158,7 @@ class ChangeList(object):
|
||||||
del p[k]
|
del p[k]
|
||||||
else:
|
else:
|
||||||
p[k] = v
|
p[k] = v
|
||||||
return '?%s' % urlencode(p)
|
return '?%s' % urlencode(sorted(p.items()))
|
||||||
|
|
||||||
def get_results(self, request):
|
def get_results(self, request):
|
||||||
paginator = self.model_admin.get_paginator(request, self.query_set, self.list_per_page)
|
paginator = self.model_admin.get_paginator(request, self.query_set, self.list_per_page)
|
||||||
|
|
|
@ -534,13 +534,13 @@ class ListFiltersTests(TestCase):
|
||||||
choices = list(filterspec.choices(changelist))
|
choices = list(filterspec.choices(changelist))
|
||||||
self.assertEqual(choices[3]['display'], 'the 2000\'s')
|
self.assertEqual(choices[3]['display'], 'the 2000\'s')
|
||||||
self.assertEqual(choices[3]['selected'], True)
|
self.assertEqual(choices[3]['selected'], True)
|
||||||
self.assertEqual(choices[3]['query_string'], '?publication-decade=the+00s&author__id__exact=%s' % self.alfred.pk)
|
self.assertEqual(choices[3]['query_string'], '?author__id__exact=%s&publication-decade=the+00s' % self.alfred.pk)
|
||||||
|
|
||||||
filterspec = changelist.get_filters(request)[0][0]
|
filterspec = changelist.get_filters(request)[0][0]
|
||||||
self.assertEqual(force_text(filterspec.title), 'Verbose Author')
|
self.assertEqual(force_text(filterspec.title), 'Verbose Author')
|
||||||
choice = select_by(filterspec.choices(changelist), "display", "alfred")
|
choice = select_by(filterspec.choices(changelist), "display", "alfred")
|
||||||
self.assertEqual(choice['selected'], True)
|
self.assertEqual(choice['selected'], True)
|
||||||
self.assertEqual(choice['query_string'], '?publication-decade=the+00s&author__id__exact=%s' % self.alfred.pk)
|
self.assertEqual(choice['query_string'], '?author__id__exact=%s&publication-decade=the+00s' % self.alfred.pk)
|
||||||
|
|
||||||
def test_listfilter_without_title(self):
|
def test_listfilter_without_title(self):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -3545,14 +3545,14 @@ class DateHierarchyTests(TestCase):
|
||||||
|
|
||||||
def assert_contains_month_link(self, response, date):
|
def assert_contains_month_link(self, response, date):
|
||||||
self.assertContains(
|
self.assertContains(
|
||||||
response, '?release_date__year=%d&release_date__month=%d"' % (
|
response, '?release_date__month=%d&release_date__year=%d"' % (
|
||||||
date.year, date.month))
|
date.month, date.year))
|
||||||
|
|
||||||
def assert_contains_day_link(self, response, date):
|
def assert_contains_day_link(self, response, date):
|
||||||
self.assertContains(
|
self.assertContains(
|
||||||
response, '?release_date__year=%d&'
|
response, '?release_date__day=%d&'
|
||||||
'release_date__month=%d&release_date__day=%d"' % (
|
'release_date__month=%d&release_date__year=%d"' % (
|
||||||
date.year, date.month, date.day))
|
date.day, date.month, date.year))
|
||||||
|
|
||||||
def test_empty(self):
|
def test_empty(self):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue