summaryrefslogtreecommitdiff
path: root/tests/admin_filters
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2015-08-28 09:25:54 -0400
committerTim Graham <timograham@gmail.com>2015-09-01 07:59:39 -0400
commit064d4b1cb01cbab0461469254a11c918e6b15cbd (patch)
tree4e1e000593f3677aa93ccb9ce7d11b259e47644e /tests/admin_filters
parent4c30fa905d9d47b3a2ee82095b1fe56cc2ec2ab5 (diff)
downloaddjango-064d4b1cb01cbab0461469254a11c918e6b15cbd.tar.gz
Fixed #25320 -- Reverted ManyToManyField.null to False for backwards compatibility.
Thanks Tom Christie for the report and review.
Diffstat (limited to 'tests/admin_filters')
-rw-r--r--tests/admin_filters/tests.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/admin_filters/tests.py b/tests/admin_filters/tests.py
index f01f9dff10..5a230cd983 100644
--- a/tests/admin_filters/tests.py
+++ b/tests/admin_filters/tests.py
@@ -523,6 +523,16 @@ class ListFiltersTests(TestCase):
self.assertEqual(choice['selected'], True)
self.assertEqual(choice['query_string'], '?books_contributed__id__exact=%d' % self.django_book.pk)
+ # With one book, the list filter should appear because there is also a
+ # (None) option.
+ Book.objects.exclude(pk=self.djangonaut_book.pk).delete()
+ filterspec = changelist.get_filters(request)[0]
+ self.assertEqual(len(filterspec), 2)
+ # With no books remaining, no list filters should appear.
+ Book.objects.all().delete()
+ filterspec = changelist.get_filters(request)[0]
+ self.assertEqual(len(filterspec), 0)
+
def test_relatedonlyfieldlistfilter_foreignkey(self):
modeladmin = BookAdminRelatedOnlyFilter(Book, site)