1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #31590 -- Fixed ModelAdmin.date_hierarchy crash with an empty QuerySet.

Regression in 55cdf6c52d.
This commit is contained in:
kjpc-tech
2020-05-14 16:56:21 -06:00
committed by Mariusz Felisiak
parent 9d211f149a
commit 099bce1bf0
2 changed files with 10 additions and 5 deletions

View File

@@ -969,6 +969,11 @@ class AdminViewBasicTest(AdminViewBasicTestCase):
self.assertEqual(response.context['site_url'], '/my-site-url/')
self.assertContains(response, '<a href="/my-site-url/">View site</a>')
def test_date_hierarchy_empty_queryset(self):
self.assertIs(Question.objects.exists(), False)
response = self.client.get(reverse('admin:admin_views_answer2_changelist'))
self.assertEqual(response.status_code, 200)
@override_settings(TIME_ZONE='America/Sao_Paulo', USE_TZ=True)
def test_date_hierarchy_timezone_dst(self):
# This datetime doesn't exist in this timezone due to DST.