def to_primitive(self, value, context=None):
        """ Schematics serializer override

        The return values vary to indicate whether or not the
        relationships is loaded with values (list with members),
        loaded but no values (empty list), or never loaded &
        unknown if values exist or not.
        """

        data = []

        if not value.is_loaded:
            return None

        for model in value.models:
            if context and context.get('rel_ids'):
                data.append(model.rid_value)
            else:
                data.append({'rtype': model.rtype, 'rid': model.rid_value})

        return data
def to_primitive ( self , value , context = None ) : data = [ ] if not value . is_loaded : return None for model in value . models : if context and context . get ( 'rel_ids' ) : data . append ( model . rid_value ) else : data . append ( { 'rtype' : model . rtype , 'rid' : model . rid_value } ) return data
Schematics serializer override

        The return values vary to indicate whether or not the
        relationships is loaded with values (list with members),
        loaded but no values (empty list), or never loaded &
        unknown if values exist or not.