mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #14878 -- Clarified the way verbose_name_plural is used in generic list views as a context variable. Thanks to diegueus9 for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15133 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
from django.test import TestCase
|
||||
|
||||
from regressiontests.generic_views.models import Author
|
||||
from regressiontests.generic_views.models import Author, Artist
|
||||
from regressiontests.generic_views.views import CustomPaginator
|
||||
|
||||
class ListViewTests(TestCase):
|
||||
@@ -106,6 +106,16 @@ class ListViewTests(TestCase):
|
||||
self.assertEqual(res.status_code, 200)
|
||||
self.assertEqual(len(res.context['object_list']), 1)
|
||||
|
||||
def test_verbose_name(self):
|
||||
res = self.client.get('/list/artists/')
|
||||
self.assertEqual(res.status_code, 200)
|
||||
self.assertTemplateUsed(res, 'generic_views/list.html')
|
||||
self.assertEqual(list(res.context['object_list']), list(Artist.objects.all()))
|
||||
self.assertIs(res.context['professional_artists'], res.context['object_list'])
|
||||
self.assertIsNone(res.context['paginator'])
|
||||
self.assertIsNone(res.context['page_obj'])
|
||||
self.assertFalse(res.context['is_paginated'])
|
||||
|
||||
def test_allow_empty_false(self):
|
||||
res = self.client.get('/list/authors/notempty/')
|
||||
self.assertEqual(res.status_code, 200)
|
||||
|
||||
Reference in New Issue
Block a user