Ticket #8153: modeladmin_options_test.diff
File modeladmin_options_test.diff, 2.1 KB (added by , 16 years ago) |
---|
-
tests/regressiontests/admin_views/tests.py
1 1 # coding: utf-8 2 2 from django.test import TestCase 3 3 from django.contrib.auth.models import User, Permission 4 4 from django.contrib.contenttypes.models import ContentType … … 154 154 def testAddView(self): 155 155 """Test add view restricts access and actually adds items.""" 156 156 157 add_dict = {'content': '<p>great article</p>', 157 add_dict = {'title' : 'Døm ikke', 158 'content': '<p>great article</p>', 158 159 'date_0': '2008-03-18', 'date_1': '10:54:39', 159 160 'section': 1} 160 161 … … 197 198 def testChangeView(self): 198 199 """Change view should restrict access and allow users to edit items.""" 199 200 200 change_dict = {'content': '<p>edited article</p>', 201 'date_0': '2008-03-18', 'date_1': '10:54:39', 202 'section': 1} 201 change_dict = {'title' : 'Ikke fordømt', 202 'content': '<p>edited article</p>', 203 'date_0': '2008-03-18', 'date_1': '10:54:39', 204 'section': 1} 203 205 204 206 # add user shoud not be able to view the list of article or change any of them 205 207 self.client.get('/test_admin/admin/') -
tests/regressiontests/admin_views/models.py
12 12 """ 13 13 A simple article to test admin views. Test backwards compatibility. 14 14 """ 15 title = models.CharField(max_length=100) 15 16 content = models.TextField() 16 17 date = models.DateTimeField() 17 18 section = models.ForeignKey(Section) 18 19 20 def __unicode__(self): 21 return self.title 22 23 19 24 class ArticleAdmin(admin.ModelAdmin): 20 25 list_display = ('content', 'date') 21 26 list_filter = ('date',)