Pass non-JSON serializable values through unmodified

This commit is contained in:
Dave Allan 2017-04-26 13:48:49 -04:00
parent 7a0bd1c4d1
commit f56b117064

View File

@ -85,7 +85,11 @@ class BoundField(object):
class JSONBoundField(BoundField): class JSONBoundField(BoundField):
def as_form_field(self): def as_form_field(self):
value = json.dumps(self.value, sort_keys=True, indent=4) value = self.value
try:
value = json.dumps(self.value, sort_keys=True, indent=4)
except TypeError:
pass
return self.__class__(self._field, value, self.errors, self._prefix) return self.__class__(self._field, value, self.errors, self._prefix)