diff --git a/tests/generic_inline_admin/models.py b/tests/generic_inline_admin/models.py
index d15f2b9..491536b 100644
a
|
b
|
class PhoneNumber(models.Model):
|
48 | 48 | |
49 | 49 | class Contact(models.Model): |
50 | 50 | name = models.CharField(max_length=50) |
51 | | phone_numbers = GenericRelation(PhoneNumber) |
| 51 | phone_numbers = GenericRelation(PhoneNumber, related_query_name='phone_numbers') |
52 | 52 | |
53 | 53 | |
54 | 54 | # |
diff --git a/tests/generic_inline_admin/tests.py b/tests/generic_inline_admin/tests.py
index c545608..cc09e73 100644
a
|
b
|
from django.contrib.admin.sites import AdminSite
|
8 | 8 | from django.contrib.auth.models import User |
9 | 9 | from django.contrib.contenttypes.admin import GenericTabularInline |
10 | 10 | from django.contrib.contenttypes.forms import generic_inlineformset_factory |
| 11 | from django.contrib.contenttypes.models import ContentType |
11 | 12 | from django.core.urlresolvers import reverse |
12 | 13 | from django.forms.formsets import DEFAULT_MAX_NUM |
13 | 14 | from django.forms.models import ModelForm |
… |
… |
from django.test import (
|
16 | 17 | ) |
17 | 18 | |
18 | 19 | from .admin import MediaInline, MediaPermanentInline, site as admin_site |
19 | | from .models import Category, Episode, EpisodePermanent, Media |
| 20 | from .models import Category, Episode, EpisodePermanent, Media, PhoneNumber |
20 | 21 | |
21 | 22 | |
22 | 23 | class TestDataMixin(object): |
… |
… |
class GenericInlineAdminWithUniqueTogetherTest(TestDataMixin, TestCase):
|
313 | 314 | response = self.client.post(reverse('admin:generic_inline_admin_contact_add'), post_data) |
314 | 315 | self.assertEqual(response.status_code, 302) # redirect somewhere |
315 | 316 | |
| 317 | def test_delete(self): |
| 318 | from .models import Contact |
| 319 | c = Contact.objects.create(name='foo') |
| 320 | PhoneNumber.objects.create( |
| 321 | object_id=c.id, |
| 322 | content_type=ContentType.objects.get_for_model(Contact), |
| 323 | phone_number="555-555-5555", |
| 324 | ) |
| 325 | response = self.client.post(reverse('admin:generic_inline_admin_contact_delete', args=[c.pk])) |
| 326 | self.assertContains(response, 'Are you sure you want to delete') |
| 327 | |
316 | 328 | |
317 | 329 | @override_settings(ROOT_URLCONF="generic_inline_admin.urls") |
318 | 330 | class NoInlineDeletionTest(SimpleTestCase): |