mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-11 04:07:39 +03:00
Fix for 1, 0 being rendered as true, false in the admin. Closes #3227.
This commit is contained in:
parent
e63dcab8b3
commit
65e1c938eb
|
@ -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]):
|
||||
|
|
Loading…
Reference in New Issue
Block a user