fix get_matches

This commit is contained in:
j 2012-01-09 00:08:05 +05:30
parent 771cec5779
commit d6b9929052
3 changed files with 4 additions and 5 deletions

View file

@ -69,8 +69,8 @@ class Event(models.Model):
return False return False
def get_matches(self): def get_matches(self):
layers = filter(lambda l: l['type'] == 'event' or l.get('hasEvents'), layers = [l['id'] for l in filter(lambda l: l['type'] == 'event' or l.get('hasEvents'),
settings.CONFIG['layers']) settings.CONFIG['layers'])]
super_matches = [] super_matches = []
q = Q(name_find__contains=" " + self.name)|Q(name_find__contains="|%s"%self.name) q = Q(name_find__contains=" " + self.name)|Q(name_find__contains="|%s"%self.name)
for name in self.alternativeNames: for name in self.alternativeNames:

View file

@ -83,8 +83,8 @@ class Place(models.Model):
return j return j
def get_matches(self): def get_matches(self):
layers = filter(lambda l: l['type'] == 'place' or l.get('hasPlaces'), layers = [l['id'] for l in filter(lambda l: l['type'] == 'place' or l.get('hasPlaces'),
settings.CONFIG['layers']) settings.CONFIG['layers'])]
super_matches = [] super_matches = []
q = Q(name_find__contains=" " + self.name)|Q(name_find__contains="|%s"%self.name) q = Q(name_find__contains=" " + self.name)|Q(name_find__contains="|%s"%self.name)
for name in self.alternativeNames: for name in self.alternativeNames:

View file

@ -22,7 +22,6 @@ from item.models import Access, Item
from item import utils from item import utils
import models import models
import managers
def signin(request): def signin(request):