mirror of
https://github.com/django/django.git
synced 2025-10-25 14:46:09 +00:00
[3.1.x] Fixed #31590 -- Fixed ModelAdmin.date_hierarchy crash with an empty QuerySet.
Regression in55cdf6c52d. Backport of099bce1bf0from master
This commit is contained in:
committed by
Mariusz Felisiak
parent
b46b0f80e8
commit
ef19aec2ca
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user