def render(self, request):
        callback = request.GET.get('callback', None)
        try:
            indent = int(request.GET['indent'])
        except (KeyError, ValueError):
            indent = None

        data = self.construct()

        if isinstance(self.data, QuerySet):
            unicode_lookup_table = dict()

            [unicode_lookup_table.__setitem__(item.pk, unicode(item)) \
                for item in self.data]

            for dict_item in data:
                try:
                    id = dict_item['id']
                except KeyError:
                    raise KeyError('The handler of the model that you want '\
                        'to emit as DojoData needs to expose the `id` field!')
                else:
                    dict_item.setdefault('_unicode', unicode_lookup_table[id])

            data = {
                'identifier': 'id',
                'items': data,
                'label': '_unicode',
                'numRows': self.data.count(),
            }

        serialized_data = json.dumps(data, ensure_ascii=False,
            cls=DateTimeAwareJSONEncoder, indent=indent)

        if callback and is_valid_jsonp_callback_value(callback):
            return '%s(%s)' % (callback, serialized_data)

        return serialized_data
Renders dojo.data compatible JSON if self.data is a QuerySet, falls
dataset/ETHPy150Open klipstein/dojango/dojango/data/piston/emitters.py/DojoDataEmitter.render