summaryrefslogtreecommitdiff
path: root/tests/generic_inline_admin/tests.py
diff options
context:
space:
mode:
authorMarkus Holtermann <info@markusholtermann.eu>2015-06-18 21:57:08 +0200
committerMarkus Holtermann <info@markusholtermann.eu>2015-06-19 19:02:01 +0200
commitd3d66d47222dd8765a20a15fdc754c0ed7635404 (patch)
treed6caaeb41812552f771f121808d11463fb822116 /tests/generic_inline_admin/tests.py
parent200e06a5ee01a5fb7c8d83dfbc59427db59798c2 (diff)
Fixed #24940 -- Made model managers hashable
Thanks Federico Jaramillo Martínez for the report and Tim Graham for the test and review.
Diffstat (limited to 'tests/generic_inline_admin/tests.py')
-rw-r--r--tests/generic_inline_admin/tests.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/generic_inline_admin/tests.py b/tests/generic_inline_admin/tests.py
index c5456084fc..cc09e739d4 100644
--- a/tests/generic_inline_admin/tests.py
+++ b/tests/generic_inline_admin/tests.py
@@ -8,6 +8,7 @@ from django.contrib.admin.sites import AdminSite
from django.contrib.auth.models import User
from django.contrib.contenttypes.admin import GenericTabularInline
from django.contrib.contenttypes.forms import generic_inlineformset_factory
+from django.contrib.contenttypes.models import ContentType
from django.core.urlresolvers import reverse
from django.forms.formsets import DEFAULT_MAX_NUM
from django.forms.models import ModelForm
@@ -16,7 +17,7 @@ from django.test import (
)
from .admin import MediaInline, MediaPermanentInline, site as admin_site
-from .models import Category, Episode, EpisodePermanent, Media
+from .models import Category, Episode, EpisodePermanent, Media, PhoneNumber
class TestDataMixin(object):
@@ -313,6 +314,17 @@ class GenericInlineAdminWithUniqueTogetherTest(TestDataMixin, TestCase):
response = self.client.post(reverse('admin:generic_inline_admin_contact_add'), post_data)
self.assertEqual(response.status_code, 302) # redirect somewhere
+ def test_delete(self):
+ from .models import Contact
+ c = Contact.objects.create(name='foo')
+ PhoneNumber.objects.create(
+ object_id=c.id,
+ content_type=ContentType.objects.get_for_model(Contact),
+ phone_number="555-555-5555",
+ )
+ response = self.client.post(reverse('admin:generic_inline_admin_contact_delete', args=[c.pk]))
+ self.assertContains(response, 'Are you sure you want to delete')
+
@override_settings(ROOT_URLCONF="generic_inline_admin.urls")
class NoInlineDeletionTest(SimpleTestCase):