mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
[1.8.x] Fixed #24381 -- removed ForeignObjectRel opts and to_opts
These cached properies were causing problems with pickling, and in
addition they were confusingly defined: field.rel.model._meta was
not the same as field.rel.opts.
Instead users should use field.rel.related_model._meta inplace of
field.rel.opts, and field.rel.to._meta in place of field.rel.to_opts.
Backport of f95122e541 from master
This commit is contained in:
committed by
Tim Graham
parent
980dfca717
commit
155a127afb
@@ -316,7 +316,7 @@ def label_for_field(name, model, model_admin=None, return_attr=False):
|
||||
label = field.verbose_name
|
||||
except AttributeError:
|
||||
# field is likely a ForeignObjectRel
|
||||
label = field.opts.verbose_name
|
||||
label = field.related_model._meta.verbose_name
|
||||
except FieldDoesNotExist:
|
||||
if name == "__unicode__":
|
||||
label = force_text(model._meta.verbose_name)
|
||||
|
||||
Reference in New Issue
Block a user