Created
October 4, 2012 21:35
-
-
Save glenrobertson/3836610 to your computer and use it in GitHub Desktop.
Combine Django GeoManager with HStoreManager
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pip install django-orm-extensions | |
from django.contrib.gis.db.models.query import GeoQuerySet | |
from django.contrib.gis.db.models import GeoManager | |
from django_orm.postgresql.hstore.queryset import HStoreQuerySet | |
from django_orm.postgresql.hstore.manager import HStoreManager | |
class GeoHStoreQuerySet(GeoQuerySet, HStoreQuerySet): | |
pass | |
class GeoHStoreManager(models.GeoManager, HStoreManager): | |
def get_query_set(self): | |
return GeoHStoreQuerySet(self.model, using=self._db) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
came up with this to that filter(some_field__contains) works
pip install django-orm-extensions
from django.contrib.gis.db.models import GeoManager
from django.contrib.gis.db.models.query import GeoQuerySet
from django.contrib.gis.db.models.sql.where import GeoWhereNode
from django.contrib.gis.db.models.sql import GeoQuery
from django_hstore.query import HStoreQuerySet, HStoreWhereNode
from django_hstore.managers import HStoreManager
class GeoHStoreWhereNode(GeoWhereNode, HStoreWhereNode):
pass
class GeoHStoreQuerySet(GeoQuerySet, HStoreQuerySet):
class GeoHStoreManager(GeoManager, HStoreManager):