Ticket #5373: 5373_regressiontests_admin_inlines.diff

File 5373_regressiontests_admin_inlines.diff, 1.9 KB (added by Lachlan Musicman, 14 years ago)

regression test to check admin_inlines

  • tests/regressiontests/admin_inlines/tests.py

     
    11from django.test import TestCase
    22
    33# local test models
     4from models import Book, Author, BookInline
    45from models import Holder, Inner, InnerInline
    56from models import Holder2, Inner2, Holder3, Inner3
    67from models import Person, OutfitItem, Fashionista
     
    3839                                   % holder.id)
    3940        self.assertContains(response, '<label>Inner readonly label:</label>')
    4041
     42    def test_fk_verbose_name(self):
     43        """ Bug 5373: checking the fk verbose name """
     44        book = Book.objects.create(name='mybio')
     45        response = self.client.get('/test_admin/admin/admin_inlines/author/add/')
     46        self.assertContains(response, 'Novel')
     47
    4148    def test_many_to_many_inlines(self):
    4249        "Autogenerated many-to-many inlines are displayed correctly (#13407)"
    4350        response = self.client.get('/test_admin/admin/admin_inlines/author/add/')
  • tests/regressiontests/admin_inlines/models.py

     
    66from django.contrib import admin
    77from django.contrib.contenttypes.models import ContentType
    88from django.contrib.contenttypes import generic
     9from django.utils.translation import ugettext_lazy as _
    910
    1011class Parent(models.Model):
    1112    name = models.CharField(max_length=50)
     
    3233
    3334class Book(models.Model):
    3435    name = models.CharField(max_length=50)
     36 
     37    class Meta:
     38        verbose_name = _(u'Novel')
     39        verbose_name_plural = _(u'Novels')
    3540
    3641class Author(models.Model):
    3742    name = models.CharField(max_length=50)
Back to Top