Ticket #8487: t8487_r8471_tests.diff
File t8487_r8471_tests.diff, 2.0 KB (added by , 16 years ago) |
---|
-
django/tests/regressiontests/admin_views/models.py
1 # coding=utf-8 1 2 from django.db import models 2 3 from django.contrib import admin 3 4 … … class Article(models.Model): 16 17 content = models.TextField() 17 18 date = models.DateTimeField() 18 19 section = models.ForeignKey(Section) 19 20 21 def title_method(self): 22 """ Test that short descriptions with international characters work """ 23 return self.title 24 title_method.short_description = "Tími" 25 20 26 def __unicode__(self): 21 27 return self.title 22 28 … … class ArticleInline(admin.TabularInline): 24 30 model = Article 25 31 26 32 class ArticleAdmin(admin.ModelAdmin): 27 list_display = (' content', 'date')33 list_display = ('title_method', 'content', 'date') 28 34 list_filter = ('date',) 29 35 30 36 def changelist_view(self, request): -
django/tests/regressiontests/admin_views/tests.py
class AdminViewBasicTest(TestCase): 29 29 '/test_admin/admin/admin_views/article/add/' 30 30 ) 31 31 32 def testBasicChangeListGet(self): 33 """ 34 A smoke test to ensure GET on the changelist_view works. 35 Additionally tests that international characters may be used in a list_display method's short_description. 36 """ 37 response = self.client.get('/test_admin/admin/admin_views/article/') 38 self.failUnlessEqual(response.status_code, 200) 39 self.failUnless("Tími" in response.content) 40 32 41 def testBasicAddGet(self): 33 42 """ 34 43 A smoke test to ensure GET on the add_view works.