django-geosimple
django-geosimple copied to clipboard
Doesn't work with Django 1.9.3
The following error is thrown when a filtering by distance is done (in Django 1.9.3):
16
17 def _clone(self, klass=None, setup=False, **kw):
---> 18 c = super(GeoQuerySet, self)._clone(klass, setup, **kw)
19 c._postprocess = copy(self._postprocess)
20 return c
TypeError: _clone() takes exactly 1 argument (3 given)
Since _clone signature changed in the QuerySet class in Django 1.9.
I temporarily fixed it by defining and using the following custom manager in my models:
from geosimple.managers import GeoManager, GeoQuerySet
from copy import copy
class CustomGeoQuerySet(GeoQuerySet):
def _clone(self, **kw):
c = super(GeoQuerySet, self)._clone(**kw)
c._postprocess = copy(self._postprocess)
return c
class CustomGeoManager(GeoManager):
def get_query_set(self):
return CustomGeoQuerySet(self.model)