default operators, type fix
This commit is contained in:
parent
503d17522d
commit
6c2358ed09
2 changed files with 3 additions and 2 deletions
|
@ -13,7 +13,7 @@ import models
|
|||
|
||||
|
||||
def keyType(key):
|
||||
if key in ('released'):
|
||||
if key in ('released', ):
|
||||
return "date"
|
||||
if key in ('year', 'cast.length'):
|
||||
return "int"
|
||||
|
@ -66,8 +66,10 @@ class MovieManager(Manager):
|
|||
conditions = []
|
||||
for condition in data['query']['conditions']:
|
||||
k = condition.get('key', 'all')
|
||||
if not k: k = 'all'
|
||||
v = condition['value']
|
||||
op = condition.get('operator', None)
|
||||
if not op: op = '~'
|
||||
if op.startswith('!'):
|
||||
op = op[1:]
|
||||
exclude = True
|
||||
|
|
|
@ -95,7 +95,6 @@ def _parse_query(data, user):
|
|||
for key in ('sort', 'keys', 'group', 'list', 'range', 'ids'):
|
||||
if key in data:
|
||||
query[key] = data[key]
|
||||
print query
|
||||
query['qs'] = models.Movie.objects.find(data, user)
|
||||
#group by only allows sorting by name or number of itmes
|
||||
return query
|
||||
|
|
Loading…
Reference in a new issue