Ticket #15968: 15968-testcase.patch

File 15968-testcase.patch, 1.4 KB (added by Aymeric Augustin, 14 years ago)
  • tests/regressiontests/admin_views/tests.py

     
    26832683        response = self.client.get('/test_admin/admin/admin_views/pizza/add/')
    26842684        self.assertEqual(response.status_code, 200)
    26852685
     2686    def test_readonly_form_label(self):
     2687        "Regression test for #15968"
     2688        response = self.client.get('/test_admin/admin/admin_views/pizza/add/')
     2689        self.assertIn('customer requirement', response.content)
    26862690
    26872691class RawIdFieldsTest(TestCase):
    26882692    fixtures = ['admin-views-users.xml']
  • tests/regressiontests/admin_views/models.py

     
    691691class Pizza(models.Model):
    692692    name = models.CharField(max_length=20)
    693693    toppings = models.ManyToManyField('Topping')
     694    comments = models.CharField(max_length=100)
    694695
     696class PizzaForm(forms.ModelForm):
     697    comments = forms.CharField(label='customer requirements')
     698
    695699class PizzaAdmin(admin.ModelAdmin):
    696     readonly_fields = ('toppings',)
     700    form = PizzaForm
     701    readonly_fields = ('toppings', 'comments')
    697702
    698703class Album(models.Model):
    699704    owner = models.ForeignKey(User)
Back to Top