mirror of
https://github.com/django/django.git
synced 2025-09-26 12:09:19 +00:00
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.
This commit is contained in:
parent
cf8d6e9108
commit
af953c45cc
4 changed files with 26 additions and 5 deletions
|
@ -50,7 +50,8 @@ from .models import (Article, BarAccount, CustomArticle, EmptyModel, FooAccount,
|
|||
OtherStory, ComplexSortedPerson, PluggableSearchPerson, Parent, Child, AdminOrderedField,
|
||||
AdminOrderedModelMethod, AdminOrderedAdminMethod, AdminOrderedCallable,
|
||||
Report, MainPrepopulated, RelatedPrepopulated, UnorderedObject,
|
||||
Simple, UndeletableObject, UnchangeableObject, Choice, ShortMessage, Telegram)
|
||||
Simple, UndeletableObject, UnchangeableObject, Choice, ShortMessage,
|
||||
Telegram, Pizza, Topping)
|
||||
from .admin import site, site2
|
||||
|
||||
|
||||
|
@ -3638,6 +3639,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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue