Fix for 1, 0 being rendered as true, false in the admin. Closes #3227.

This commit is contained in:
Tom Christie 2015-08-07 14:38:36 +01:00
parent e63dcab8b3
commit 65e1c938eb

View File

@ -111,7 +111,7 @@ def add_class(value, css_class):
def format_value(value):
if getattr(value, 'is_hyperlink', False):
return mark_safe('<a href=%s>%s</a>' % (value, escape(value.name)))
if value in (True, False, None):
if value is None or isinstance(value, bool):
return mark_safe('<code>%s</code>' % {True: 'true', False: 'false', None: 'null'}[value])
elif isinstance(value, list):
if any([isinstance(item, (list, dict)) for item in value]):