I am learning to use GeoDjango, and it is my understanding that a GeoManager() is needed to interact with GIS objects.
However, I was trying to build in some search functionality for my models. I found this old post that showed how to build a nifty little search manager using q objects like so:
class NewsPostManager(models.Manager):
def search(self, search_terms):
terms = [term.strip() for term in search_terms.split()]
q_objects = []
for term in terms:
q_objects.append(Q(title__icontains=term))
q_objects.append(Q(content__icontains=term))
# Start with a bare QuerySet
qs = self.get_query_set()
# Use operator's or_ to string together all of your Q objects.
return qs.filter(reduce(operator.or_, q_objects))
It is my understanding that this wouldn't work for GIS objects, as it doesn't invoke models.GeoManager(). Is there a way to extend models.GeoManager with this added functionality?