Skip to content
This repository has been archived by the owner. It is now read-only.
Browse files
ARIA-417 Encoding models to json is too strict
  • Loading branch information
mxmrlv authored and aviaefrat committed Dec 4, 2017
1 parent bc2701c commit 1f5260cfb7516822d593d6103b7aa09ae9f86b84
Showing 1 changed file with 3 additions and 4 deletions.
@@ -35,15 +35,14 @@ def __init__(self, *args, **kwargs):
# Just here to make sure Sphinx doesn't grab the base constructor's docstring
super(ModelJSONEncoder, self).__init__(*args, **kwargs)

def default(self, o): # pylint: disable=method-hidden
from .mixins import ModelMixin
if isinstance(o, ModelMixin):
def default(self, o): # pylint: disable=method-hidden
if hasattr(o, 'value'):
dict_to_return = o.to_dict(fields=('value',))
return dict_to_return['value']
return o.to_dict()
except AttributeError:
return JSONEncoder.default(self, o)

0 comments on commit 1f5260c

Please sign in to comment.