Skip to content

Instantly share code, notes, and snippets.

@goodwillcoding
goodwillcoding / gist:3808931
Created October 1, 2012 01:17
JSON Serializable SQLAlchemy Object
class JsonSerializableMixin(object):
"""
Converts all the properties of the object into a dict for use in json.
You can define the following as your class properties.
_json_eager_load :
list of which child classes need to be eagerly loaded. This applies
to one-to-many relationships defined in SQLAlchemy classes.
_base_blacklist :
@goodwillcoding
goodwillcoding / gist:3808856
Created October 1, 2012 00:45 — forked from pjenvey/gist:3808830
JSON Serializable SQLAlchemy Object
class JsonSerializableMixin(object):
def __json__(self, request):
"""
Converts all the properties of the object into a dict for use in json.
You can define the following in your class
_json_eager_load :
list of which child classes need to be eagerly loaded. This applies
to one-to-many relationships defined in SQLAlchemy classes.
@goodwillcoding
goodwillcoding / gist:3808838
Created October 1, 2012 00:39
JSON Serializable SQLAlchemy Object
class JsonSerializableMixin(object):
def __json__(self, request):
"""
Converts all the properties of the object into a dict for use in json.
You can define the following in your class
_json_eager_load :
list of which child classes need to be eagerly loaded. This applies
to one-to-many relationships defined in SQLAlchemy classes.