diff options
author | Dan McGee <dan@archlinux.org> | 2014-10-21 09:11:48 -0500 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2014-10-21 09:40:14 -0500 |
commit | 087b4b00031fed52eeddf05ae36825cb498680f0 (patch) | |
tree | d322b4d452c0d09827095960e38fac449cabc307 /mirrors | |
parent | ee6bf2782068b917232c71189aea0011b47e876d (diff) |
Remove queryset specialization in JSON encoder
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'mirrors')
-rw-r--r-- | mirrors/views.py | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/mirrors/views.py b/mirrors/views.py index 0bf0a267..1a9741ed 100644 --- a/mirrors/views.py +++ b/mirrors/views.py @@ -323,9 +323,6 @@ class LocationJSONEncoder(DjangoJSONEncoder): '''Base JSONEncoder extended to handle CheckLocation objects.''' def default(self, obj): - if hasattr(obj, '__iter__'): - # mainly for queryset serialization - return list(obj) if isinstance(obj, CheckLocation): return { 'id': obj.pk, @@ -341,7 +338,7 @@ class LocationJSONEncoder(DjangoJSONEncoder): def locations_json(request): data = {} data['version'] = 1 - data['locations'] = CheckLocation.objects.all().order_by('pk') + data['locations'] = list(CheckLocation.objects.all().order_by('pk')) to_json = json.dumps(data, ensure_ascii=False, cls=LocationJSONEncoder) response = HttpResponse(to_json, content_type='application/json') return response |