Ticket #8153: modeladmin_options_test.diff

File modeladmin_options_test.diff, 2.1 KB (added by Nils Fredrik Gjerull, 16 years ago)
  • tests/regressiontests/admin_views/tests.py

     
    1 
     1# coding: utf-8
    22from django.test import TestCase
    33from django.contrib.auth.models import User, Permission
    44from django.contrib.contenttypes.models import ContentType
     
    154154    def testAddView(self):
    155155        """Test add view restricts access and actually adds items."""
    156156       
    157         add_dict = {'content': '<p>great article</p>',
     157        add_dict = {'title' : 'Døm ikke',
     158                    'content': '<p>great article</p>',
    158159                    'date_0': '2008-03-18', 'date_1': '10:54:39',
    159160                    'section': 1}
    160161       
     
    197198    def testChangeView(self):
    198199        """Change view should restrict access and allow users to edit items."""
    199200       
    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}
    203205       
    204206        # add user shoud not be able to view the list of article or change any of them
    205207        self.client.get('/test_admin/admin/')
  • tests/regressiontests/admin_views/models.py

     
    1212    """
    1313    A simple article to test admin views. Test backwards compatibility.
    1414    """
     15    title = models.CharField(max_length=100)   
    1516    content = models.TextField()
    1617    date = models.DateTimeField()
    1718    section = models.ForeignKey(Section)
    1819
     20    def __unicode__(self):
     21        return self.title
     22
     23
    1924class ArticleAdmin(admin.ModelAdmin):
    2025    list_display = ('content', 'date')
    2126    list_filter = ('date',)
Back to Top