From 8b99603120bef34204a34d7706c698f1cd19a365 Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Sat, 14 Nov 2015 10:23:36 -0500 Subject: [PATCH] [1.8.x] Fixed admin_filters test failures when run in reverse. Backport of b1b14587aedbb4fd37a99b7bf5345abae279322d from master --- tests/admin_filters/tests.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/admin_filters/tests.py b/tests/admin_filters/tests.py index 56469f65b6..0956d99b89 100644 --- a/tests/admin_filters/tests.py +++ b/tests/admin_filters/tests.py @@ -866,7 +866,7 @@ class ListFiltersTests(TestCase): """ modeladmin = DepartmentFilterEmployeeAdmin(Employee, site) - request = self.request_factory.get('/', {'department': self.john.pk}) + request = self.request_factory.get('/', {'department': self.john.department.pk}) changelist = self.get_changelist(request, Employee, modeladmin) queryset = changelist.get_queryset(request) @@ -878,7 +878,7 @@ class ListFiltersTests(TestCase): choices = list(filterspec.choices(changelist)) self.assertEqual(choices[1]['display'], 'DEV') self.assertEqual(choices[1]['selected'], True) - self.assertEqual(choices[1]['query_string'], '?department=%s' % self.john.pk) + self.assertEqual(choices[1]['query_string'], '?department=%s' % self.john.department.pk) def test_lookup_with_non_string_value_underscored(self): """ @@ -887,7 +887,7 @@ class ListFiltersTests(TestCase): Refs #19182 """ modeladmin = DepartmentFilterUnderscoredEmployeeAdmin(Employee, site) - request = self.request_factory.get('/', {'department__whatever': self.john.pk}) + request = self.request_factory.get('/', {'department__whatever': self.john.department.pk}) changelist = self.get_changelist(request, Employee, modeladmin) queryset = changelist.get_queryset(request) @@ -899,7 +899,7 @@ class ListFiltersTests(TestCase): choices = list(filterspec.choices(changelist)) self.assertEqual(choices[1]['display'], 'DEV') self.assertEqual(choices[1]['selected'], True) - self.assertEqual(choices[1]['query_string'], '?department__whatever=%s' % self.john.pk) + self.assertEqual(choices[1]['query_string'], '?department__whatever=%s' % self.john.department.pk) def test_fk_with_to_field(self): """