Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Made admin generated changelist URLs independent of dict ordering

  • Loading branch information...
commit c31c2c92b8ef0b58394ac55fa4f61acc07091047 1 parent 6b9f130
Luke Plant authored
2  django/contrib/admin/views/main.py
@@ -158,7 +158,7 @@ def get_query_string(self, new_params=None, remove=None):
158 158
                     del p[k]
159 159
             else:
160 160
                 p[k] = v
161  
-        return '?%s' % urlencode(p)
  161
+        return '?%s' % urlencode(sorted(p.items()))
162 162
 
163 163
     def get_results(self, request):
164 164
         paginator = self.model_admin.get_paginator(request, self.query_set, self.list_per_page)
4  tests/regressiontests/admin_filters/tests.py
@@ -534,13 +534,13 @@ def test_simplelistfilter(self):
534 534
         choices = list(filterspec.choices(changelist))
535 535
         self.assertEqual(choices[3]['display'], 'the 2000\'s')
536 536
         self.assertEqual(choices[3]['selected'], True)
537  
-        self.assertEqual(choices[3]['query_string'], '?publication-decade=the+00s&author__id__exact=%s' % self.alfred.pk)
  537
+        self.assertEqual(choices[3]['query_string'], '?author__id__exact=%s&publication-decade=the+00s' % self.alfred.pk)
538 538
 
539 539
         filterspec = changelist.get_filters(request)[0][0]
540 540
         self.assertEqual(force_text(filterspec.title), 'Verbose Author')
541 541
         choice = select_by(filterspec.choices(changelist), "display", "alfred")
542 542
         self.assertEqual(choice['selected'], True)
543  
-        self.assertEqual(choice['query_string'], '?publication-decade=the+00s&author__id__exact=%s' % self.alfred.pk)
  543
+        self.assertEqual(choice['query_string'], '?author__id__exact=%s&publication-decade=the+00s' % self.alfred.pk)
544 544
 
545 545
     def test_listfilter_without_title(self):
546 546
         """
10  tests/regressiontests/admin_views/tests.py
@@ -3545,14 +3545,14 @@ def assert_contains_year_link(self, response, date):
3545 3545
 
3546 3546
     def assert_contains_month_link(self, response, date):
3547 3547
         self.assertContains(
3548  
-            response, '?release_date__year=%d&release_date__month=%d"' % (
3549  
-                date.year, date.month))
  3548
+            response, '?release_date__month=%d&release_date__year=%d"' % (
  3549
+                date.month, date.year))
3550 3550
 
3551 3551
     def assert_contains_day_link(self, response, date):
3552 3552
         self.assertContains(
3553  
-            response, '?release_date__year=%d&'
3554  
-            'release_date__month=%d&release_date__day=%d"' % (
3555  
-                date.year, date.month, date.day))
  3553
+            response, '?release_date__day=%d&'
  3554
+            'release_date__month=%d&release_date__year=%d"' % (
  3555
+                date.day, date.month, date.year))
3556 3556
 
3557 3557
     def test_empty(self):
3558 3558
         """

0 notes on commit c31c2c9

Please sign in to comment.
Something went wrong with that request. Please try again.