1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

[1.5.x] Fixed #17911 -- Ensure that admin readonly fields' display values are shown in change forms when the raw value is None.

Backport of 29d59a879e
This commit is contained in:
Edward Tjörnhammar
2012-11-25 23:13:22 +01:00
committed by Julien Phalip
parent 22ca5bab95
commit 7c91b67cfa
4 changed files with 23 additions and 5 deletions

View File

@@ -186,9 +186,7 @@ class AdminReadonlyField(object):
if getattr(attr, "allow_tags", False):
result_repr = mark_safe(result_repr)
else:
if value is None:
result_repr = EMPTY_CHANGELIST_VALUE
elif isinstance(f.rel, ManyToManyRel):
if isinstance(f.rel, ManyToManyRel) and value is not None:
result_repr = ", ".join(map(six.text_type, value.all()))
else:
result_repr = display_for_field(value, f)