diff options
| author | Luke Plant <L.Plant.98@cantab.net> | 2011-06-01 23:17:40 +0000 |
|---|---|---|
| committer | Luke Plant <L.Plant.98@cantab.net> | 2011-06-01 23:17:40 +0000 |
| commit | 2304ca423640a7b06390530bf61c879f9ff9e4ba (patch) | |
| tree | f8eb0c7747f0bf0f0a203cd1f02728a234c286b1 /tests | |
| parent | 236708939204fca2a04e63bd7dd3b717feea70a8 (diff) | |
Fixed bug with `__str__` headers in admin changelist have a non-functioning sort URL
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16312 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/regressiontests/admin_views/tests.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/regressiontests/admin_views/tests.py b/tests/regressiontests/admin_views/tests.py index 54d89e4d75..cc5783cc86 100644 --- a/tests/regressiontests/admin_views/tests.py +++ b/tests/regressiontests/admin_views/tests.py @@ -32,7 +32,7 @@ from django.utils import unittest # local test models from models import (Article, BarAccount, CustomArticle, EmptyModel, - FooAccount, Gallery, ModelWithStringPrimaryKey, + FooAccount, Gallery, GalleryAdmin, ModelWithStringPrimaryKey, Person, Persona, Picture, Podcast, Section, Subscriber, Vodcast, Language, Collector, Widget, Grommet, DooHickey, FancyDoodad, Whatsit, Category, Post, Plot, FunkyTag, Chapter, Book, Promo, WorkHour, Employee, @@ -238,6 +238,17 @@ class AdminViewBasicTest(TestCase): "Results of sorting on ModelAdmin method are out of order." ) + def testChangeListSortColumnsDefault(self): + # Need a model that has a list_display with '__str__' as only item. + # Sanity check for assumption made in following test. + self.assertEqual(list(GalleryAdmin.list_display), ['__str__']) + # A header corresponding to '__str__' should not be in an anchor + # for sorting. + g = Gallery.objects.create(name='gallery1') + response = self.client.get('/test_admin/%s/admin_views/gallery/' % self.urlbit, {}) + m = re.search('<th scope="col">\s*Gallery\s*</th>', response.content) + self.assertTrue(m is not None) + def testLimitedFilter(self): """Ensure admin changelist filters do not contain objects excluded via limit_choices_to. This also tests relation-spanning filters (e.g. 'color__value'). |
