summaryrefslogtreecommitdiff
path: root/tests/regressiontests/admin_views
diff options
context:
space:
mode:
authorJames Bennett <ubernostrum@gmail.com>2010-03-10 08:37:17 +0000
committerJames Bennett <ubernostrum@gmail.com>2010-03-10 08:37:17 +0000
commita0c77ada990ca1e61b37d7ecdcf533e88c11a510 (patch)
tree743fbd340ebaa0c50c0f36befaf11e19c53c97bd /tests/regressiontests/admin_views
parentbaa4d3b710d4011b8badcfade907b76d122c33f9 (diff)
Ensure that NullBooleanField displays the appropriate icon for null values in admin changelists. Refs #13071.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12746 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests/admin_views')
-rw-r--r--tests/regressiontests/admin_views/models.py2
-rw-r--r--tests/regressiontests/admin_views/tests.py9
2 files changed, 11 insertions, 0 deletions
diff --git a/tests/regressiontests/admin_views/models.py b/tests/regressiontests/admin_views/models.py
index dfdb18f0be..b8b4e50ba2 100644
--- a/tests/regressiontests/admin_views/models.py
+++ b/tests/regressiontests/admin_views/models.py
@@ -464,11 +464,13 @@ class Post(models.Model):
title = models.CharField(max_length=100)
content = models.TextField()
posted = models.DateField(default=datetime.date.today)
+ public = models.NullBooleanField()
def awesomeness_level(self):
return "Very awesome."
class PostAdmin(admin.ModelAdmin):
+ list_display = ['title', 'public']
readonly_fields = ('posted', 'awesomeness_level', 'coolness', lambda obj: "foo")
inlines = [
diff --git a/tests/regressiontests/admin_views/tests.py b/tests/regressiontests/admin_views/tests.py
index b66d2956f9..655478a9ed 100644
--- a/tests/regressiontests/admin_views/tests.py
+++ b/tests/regressiontests/admin_views/tests.py
@@ -253,6 +253,15 @@ class AdminViewBasicTest(TestCase):
"Changelist filter isn't showing options contained inside a model field 'choices' option named group."
)
+ def testChangeListNullBooleanDisplay(self):
+ Post.objects.create(public=None)
+ # This hard-codes the URl because it'll fail if it runs
+ # against the 'admin2' custom admin (which doesn't have the
+ # Post model).
+ response = self.client.get("/test_admin/admin/admin_views/post/")
+ self.failUnless('icon-unknown.gif' in response.content)
+ print "Passed"
+
class SaveAsTests(TestCase):
fixtures = ['admin-views-users.xml','admin-views-person.xml']