diff options
| author | Sergey Fedoseev <fedoseev.sergey@gmail.com> | 2015-12-10 12:06:01 +0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-12-10 18:11:45 -0500 |
| commit | 515f149e4d51ddcf32db0be440da726c0ca867b4 (patch) | |
| tree | 5e365da012e40bfae42b2bcfaa1e212e4ec3f2d5 /tests | |
| parent | e7bdc72e1746f11497b20336cfc8798bfa9a46ba (diff) | |
[1.9.x] Fixed #25883 -- Fixed admin deletion page summary counts for related objects.
Backport of 8ab58b80529c5206654c1042a4ddcf2da364f8ec from master
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/admin_views/models.py | 1 | ||||
| -rw-r--r-- | tests/admin_views/tests.py | 5 |
2 files changed, 4 insertions, 2 deletions
diff --git a/tests/admin_views/models.py b/tests/admin_views/models.py index 3ecaf57b6d..9a6b63230a 100644 --- a/tests/admin_views/models.py +++ b/tests/admin_views/models.py @@ -40,6 +40,7 @@ class Article(models.Model): content = models.TextField() date = models.DateTimeField() section = models.ForeignKey(Section, models.CASCADE, null=True, blank=True) + another_section = models.ForeignKey(Section, models.CASCADE, null=True, blank=True, related_name='+') sub_section = models.ForeignKey(Section, models.SET_NULL, null=True, blank=True, related_name='+') def __str__(self): diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py index e9fcc89899..84793db5a5 100644 --- a/tests/admin_views/tests.py +++ b/tests/admin_views/tests.py @@ -1297,7 +1297,8 @@ class AdminViewPermissionsTest(TestCase): ) cls.s1 = Section.objects.create(name='Test section') cls.a1 = Article.objects.create( - content='<p>Middle content</p>', date=datetime.datetime(2008, 3, 18, 11, 54, 58), section=cls.s1 + content='<p>Middle content</p>', date=datetime.datetime(2008, 3, 18, 11, 54, 58), section=cls.s1, + another_section=cls.s1, ) cls.a2 = Article.objects.create( content='<p>Oldest content</p>', date=datetime.datetime(2000, 3, 18, 11, 54, 58), section=cls.s1 @@ -3192,7 +3193,7 @@ class AdminActionsTest(TestCase): self.assertIsInstance(confirmation, TemplateResponse) self.assertContains(confirmation, "Are you sure you want to delete the selected subscribers?") self.assertContains(confirmation, "<h2>Summary</h2>") - self.assertContains(confirmation, "<li>Subscribers: 3</li>") + self.assertContains(confirmation, "<li>Subscribers: 2</li>") self.assertContains(confirmation, "<li>External subscribers: 1</li>") self.assertContains(confirmation, ACTION_CHECKBOX_NAME, count=2) self.client.post(reverse('admin:admin_views_subscriber_changelist'), delete_confirmation_data) |
