django_api/json_helpers.py
def default(self, obj):
        """
        Convert QuerySet objects to their list counter-parts
        """
        if isinstance(obj, models.Model):
            return self.encode(model_to_dict(obj))
        elif isinstance(obj, models.query.QuerySet):
            return serializers.serialize('json', obj)
        else:
            return super(JsonResponseEncoder, self).default(obj)
def default(self, obj):
        """
        Convert QuerySet objects to their list counter-parts
        """
        if isinstance(obj, models.Model):
            return self.encode(model_to_dict(obj))
        elif isinstance(obj, models.query.QuerySet):
            return serializers.serialize('json', obj)
        else:
            return super(JsonResponseEncoder, self).default(obj)
def default ( self , obj ) : if isinstance ( obj , models . Model ) : return self . encode ( model_to_dict ( obj ) ) elif isinstance ( obj , models . query . QuerySet ) : return serializers . serialize ( 'json' , obj ) else : return super ( JsonResponseEncoder , self ) . default ( obj )
Convert QuerySet objects to their list counter-parts
Convert QuerySet objects to their list counter - parts