index.community/apiv1/_util.py
Tao Bror Bojlén 93932c5196
add graph (#1)
* add initial graph

* add graph
2018-09-01 15:32:04 +02:00

9 lines
356 B
Python

def to_representation(self, instance):
"""
Object instance -> Dict of primitive datatypes.
We use a custom to_representation function to exclude empty fields in the serialized JSON.
"""
ret = super(InstanceListSerializer, self).to_representation(instance)
ret = OrderedDict(list(filter(lambda x: x[1], ret.items())))
return ret