Skip to content

Instantly share code, notes, and snippets.

View nisc's full-sized avatar
👋

nisc

👋
  • No Instruction Set Computing
  • At some point in Berlin, Germany
View GitHub Profile
@nisc
nisc / resources.py
Created January 2, 2012 16:33 — forked from bohde/resources.py
Tastypie support for Geodjango distance filtering
class MyGeoResource(Resource):
def apply_sorting(self, objects, options=None):
if options and "longitude" in options and "latitude" in options:
return objects.distance(Point(options['latitude'], options['longitude'])).order_by('distance')
return super(MyGeoResource, self).apply_sorting(objects, options)