summaryrefslogtreecommitdiff
path: root/tests/admin_views/tests.py
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2013-08-29 09:39:31 -0400
committerTim Graham <timograham@gmail.com>2013-08-29 09:45:02 -0400
commitef1259342b46cd4b63678a4acddf2a2b631d342c (patch)
treec4039f15e8349cafd7262011586faf67b7255868 /tests/admin_views/tests.py
parent58157be5ad31b42a1dc73e357cfdece02fd0b6ee (diff)
[1.6.x] Fixed #16433 -- Fixed a help_text/read only field interaction that caused an admin crash.
Thanks chris at cogdon.org for the report and admackin for the patch. Backport of af953c45cc from master
Diffstat (limited to 'tests/admin_views/tests.py')
-rw-r--r--tests/admin_views/tests.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py
index 3c276199ff..28dea38cfd 100644
--- a/tests/admin_views/tests.py
+++ b/tests/admin_views/tests.py
@@ -49,7 +49,7 @@ from .models import (Article, BarAccount, CustomArticle, EmptyModel, FooAccount,
OtherStory, ComplexSortedPerson, PluggableSearchPerson, Parent, Child, AdminOrderedField,
AdminOrderedModelMethod, AdminOrderedAdminMethod, AdminOrderedCallable,
Report, MainPrepopulated, RelatedPrepopulated, UnorderedObject,
- Simple, UndeletableObject, Choice, ShortMessage, Telegram)
+ Simple, UndeletableObject, Choice, ShortMessage, Telegram, Pizza, Topping)
from .admin import site, site2
@@ -3559,6 +3559,17 @@ class ReadonlyTest(TestCase):
self.assertContains(response, '<p>No opinion</p>', html=True)
self.assertNotContains(response, '<p>(None)</p>')
+ def test_readonly_backwards_ref(self):
+ """
+ Regression test for #16433 - backwards references for related objects
+ broke if the related field is read-only due to the help_text attribute
+ """
+ topping = Topping.objects.create(name='Salami')
+ pizza = Pizza.objects.create(name='Americano')
+ pizza.toppings.add(topping)
+ response = self.client.get('/test_admin/admin/admin_views/topping/add/')
+ self.assertEqual(response.status_code, 200)
+
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
class RawIdFieldsTest(TestCase):