mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +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:
@@ -327,10 +327,15 @@ def label_for_field(name, model, model_admin=None, return_attr=False):
|
||||
|
||||
|
||||
def help_text_for_field(name, model):
|
||||
help_text = ""
|
||||
try:
|
||||
help_text = model._meta.get_field_by_name(name)[0].help_text
|
||||
field_data = model._meta.get_field_by_name(name)
|
||||
except models.FieldDoesNotExist:
|
||||
help_text = ""
|
||||
pass
|
||||
else:
|
||||
field = field_data[0]
|
||||
if not isinstance(field, RelatedObject):
|
||||
help_text = field.help_text
|
||||
return smart_text(help_text)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user