1
0
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:
Tim Graham
2013-08-29 09:39:31 -04:00
parent cf8d6e9108
commit af953c45cc
4 changed files with 26 additions and 5 deletions

View File

@@ -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)