allow find for id
This commit is contained in:
parent
ab40deea27
commit
ecc8d139f6
1 changed files with 3 additions and 1 deletions
|
@ -66,6 +66,7 @@ class MovieManager(Manager):
|
||||||
conditions = []
|
conditions = []
|
||||||
for condition in data['query']['conditions']:
|
for condition in data['query']['conditions']:
|
||||||
k = condition.get('key', 'all')
|
k = condition.get('key', 'all')
|
||||||
|
k = {'id': 'movieId'}.get(k, k)
|
||||||
if not k: k = 'all'
|
if not k: k = 'all'
|
||||||
v = condition['value']
|
v = condition['value']
|
||||||
op = condition.get('operator', None)
|
op = condition.get('operator', None)
|
||||||
|
@ -90,7 +91,8 @@ class MovieManager(Manager):
|
||||||
k = '%s__iendswith' % k
|
k = '%s__iendswith' % k
|
||||||
else: # elif op == '~':
|
else: # elif op == '~':
|
||||||
k = '%s__icontains' % k
|
k = '%s__icontains' % k
|
||||||
k = 'find__%s' % k
|
if not k.startswith('movieId'):
|
||||||
|
k = 'find__%s' % k
|
||||||
k = str(k)
|
k = str(k)
|
||||||
if exclude:
|
if exclude:
|
||||||
conditions.append(~Q(**{k:v}))
|
conditions.append(~Q(**{k:v}))
|
||||||
|
|
Loading…
Reference in a new issue