diff options
| author | Tim Graham <timograham@gmail.com> | 2013-08-29 09:39:31 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2013-08-29 09:39:31 -0400 |
| commit | af953c45cc56df28d02675e196eca1b54ce28a43 (patch) | |
| tree | 3a2b036ce011cca90f7319a1d4c6c695976a9223 /django | |
| parent | cf8d6e910839238ee9b2d0a094d98cb8d48dc530 (diff) | |
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.
Diffstat (limited to 'django')
| -rw-r--r-- | django/contrib/admin/util.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/django/contrib/admin/util.py b/django/contrib/admin/util.py index a36c8c13c8..030e6b682c 100644 --- a/django/contrib/admin/util.py +++ b/django/contrib/admin/util.py @@ -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) |
