From 171caadf0dd2bb0d68e5c9dc09a5360e1b3ea645 Mon Sep 17 00:00:00 2001 From: Schuyler Erle Date: Thu, 1 Sep 2011 03:18:13 -0700 Subject: [PATCH] find() returns only records with is_primary=True. --- gazetteer/places/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gazetteer/places/models.py b/gazetteer/places/models.py index 1435632..aa269a3 100644 --- a/gazetteer/places/models.py +++ b/gazetteer/places/models.py @@ -24,8 +24,8 @@ class FeatureSearchManager(models.GeoManager): cursor = connection.cursor() cursor.execute("""SELECT set_limit(%f)""" % threshold) - def find(self, bbox=None, text=None, adm1=None, adm2=None, threshold=0.5, srid=4326): - qset = self.get_query_set() + def find(self, bbox=None, text=None, adm1=None, adm2=None, is_primary=True, threshold=0.5, srid=4326): + qset = self.get_query_set().filter(is_primary=is_primary) if bbox: (minx, miny, maxx, maxy) = bbox bbox = Polygon(((minx,miny),(minx,maxy),(maxx,maxy),(maxx,miny),(minx,miny)),srid=srid)