Code

Ticket #5373: 5373_regressiontests_admin_inlines.diff

File 5373_regressiontests_admin_inlines.diff, 1.9 KB (added by datakid, 4 years ago)

regression test to check admin_inlines

Line 
1Index: tests/regressiontests/admin_inlines/tests.py
2===================================================================
3--- tests/regressiontests/admin_inlines/tests.py        (revision 13428)
4+++ tests/regressiontests/admin_inlines/tests.py        (working copy)
5@@ -1,6 +1,7 @@
6 from django.test import TestCase
7 
8 # local test models
9+from models import Book, Author, BookInline
10 from models import Holder, Inner, InnerInline
11 from models import Holder2, Inner2, Holder3, Inner3
12 from models import Person, OutfitItem, Fashionista
13@@ -38,6 +39,12 @@
14                                    % holder.id)
15         self.assertContains(response, '<label>Inner readonly label:</label>')
16 
17+    def test_fk_verbose_name(self):
18+        """ Bug 5373: checking the fk verbose name """
19+        book = Book.objects.create(name='mybio')
20+        response = self.client.get('/test_admin/admin/admin_inlines/author/add/')
21+        self.assertContains(response, 'Novel')
22+
23     def test_many_to_many_inlines(self):
24         "Autogenerated many-to-many inlines are displayed correctly (#13407)"
25         response = self.client.get('/test_admin/admin/admin_inlines/author/add/')
26Index: tests/regressiontests/admin_inlines/models.py
27===================================================================
28--- tests/regressiontests/admin_inlines/models.py       (revision 13428)
29+++ tests/regressiontests/admin_inlines/models.py       (working copy)
30@@ -6,6 +6,7 @@
31 from django.contrib import admin
32 from django.contrib.contenttypes.models import ContentType
33 from django.contrib.contenttypes import generic
34+from django.utils.translation import ugettext_lazy as _
35 
36 class Parent(models.Model):
37     name = models.CharField(max_length=50)
38@@ -32,6 +33,10 @@
39 
40 class Book(models.Model):
41     name = models.CharField(max_length=50)
42
43+    class Meta:
44+        verbose_name = _(u'Novel')
45+        verbose_name_plural = _(u'Novels')
46 
47 class Author(models.Model):
48     name = models.CharField(max_length=50)