places
This commit is contained in:
parent
6eff556204
commit
d1480f550e
4 changed files with 153 additions and 56 deletions
|
|
@ -8,13 +8,13 @@ class PlaceManager(Manager):
|
|||
def get_query_set(self):
|
||||
return super(PlaceManager, self).get_query_set()
|
||||
|
||||
def find(self, q='', f="globe", sw_lat=-180.0, sw_lng=-180.0, ne_lat=180.0, ne_lng=180.0):
|
||||
def find(self, q='', south=-180.0, west=-180.0, north=180.0, east=180.0):
|
||||
qs = self.get_query_set()
|
||||
qs = qs.filter(Q(
|
||||
Q(Q(sw_lat__gt=sw_lat)|Q(sw_lat__lt=ne_lat)|Q(sw_lng__gt=sw_lng)|Q(sw_lng__lt=ne_lng)) &
|
||||
Q(Q(sw_lat__gt=sw_lat)|Q(sw_lat__lt=ne_lat)|Q(sw_lng__lt=ne_lng)|Q(ne_lng__gt=ne_lng)) &
|
||||
Q(Q(ne_lat__gt=sw_lat)|Q(ne_lat__lt=ne_lat)|Q(sw_lng__gt=sw_lng)|Q(sw_lng__lt=ne_lng)) &
|
||||
Q(Q(ne_lat__gt=sw_lat)|Q(ne_lat__lt=ne_lat)|Q(ne_lng__gt=sw_lng)|Q(ne_lng__lt=ne_lng))
|
||||
Q(Q(south__gt=south)|Q(south__lt=north)|Q(west__gt=west)|Q(west__lt=east)) &
|
||||
Q(Q(south__gt=south)|Q(south__lt=north)|Q(west__lt=east)|Q(east__gt=east)) &
|
||||
Q(Q(north__gt=south)|Q(north__lt=north)|Q(west__gt=west)|Q(west__lt=east)) &
|
||||
Q(Q(north__gt=south)|Q(north__lt=north)|Q(east__gt=west)|Q(east__lt=east))
|
||||
))
|
||||
if q:
|
||||
qs = qs.filter(name_find__icontains=q)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue