only get director, year and director if director was passed in query
This commit is contained in:
parent
055717d461
commit
d712ff043f
2 changed files with 6 additions and 3 deletions
|
@ -249,7 +249,11 @@ class Match(models.Model):
|
|||
'director': ';'.join(sorted(data.get('director', [])))
|
||||
}
|
||||
keys = []
|
||||
for k in cls.keys:
|
||||
if not data['director']:
|
||||
_keys = [k for k in cls.keys if k not in (['director', 'year'], ['director'])]
|
||||
else:
|
||||
_keys = cls.keys
|
||||
for k in _keys:
|
||||
key = '\0'.join(k)
|
||||
value = '\0'.join([data[v] for v in k])
|
||||
if isinstance(value, unicode):
|
||||
|
@ -265,7 +269,7 @@ class Match(models.Model):
|
|||
matches = []
|
||||
items = []
|
||||
for key in cls.get_keys(data):
|
||||
for m in cls.objects.filter(key=key).order_by('item__imdb'):
|
||||
for m in cls.objects.filter(key=key).order_by('item__imdb').select_related():
|
||||
if m.item.id not in items:
|
||||
matches.append(m.json())
|
||||
items.append(m.item.id)
|
||||
|
|
|
@ -29,7 +29,6 @@ def getIds(request):
|
|||
return render_to_json_response(response)
|
||||
actions.register(getIds)
|
||||
|
||||
|
||||
def getData(request):
|
||||
response = json_response()
|
||||
data = json.loads(request.POST['data'])
|
||||
|
|
Loading…
Reference in a new issue