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:45:02 -0400 |
| commit | ef1259342b46cd4b63678a4acddf2a2b631d342c (patch) | |
| tree | c4039f15e8349cafd7262011586faf67b7255868 /django | |
| parent | 58157be5ad31b42a1dc73e357cfdece02fd0b6ee (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 '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 b31756d762..962d8f7f1d 100644 --- a/django/contrib/admin/util.py +++ b/django/contrib/admin/util.py @@ -320,10 +320,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) |
