allow find for id

This commit is contained in:
j 2010-07-06 10:04:24 +02:00
parent ab40deea27
commit ecc8d139f6
1 changed files with 3 additions and 1 deletions

View File

@ -66,6 +66,7 @@ class MovieManager(Manager):
conditions = []
for condition in data['query']['conditions']:
k = condition.get('key', 'all')
k = {'id': 'movieId'}.get(k, k)
if not k: k = 'all'
v = condition['value']
op = condition.get('operator', None)
@ -90,7 +91,8 @@ class MovieManager(Manager):
k = '%s__iendswith' % k
else: # elif op == '~':
k = '%s__icontains' % k
k = 'find__%s' % k
if not k.startswith('movieId'):
k = 'find__%s' % k
k = str(k)
if exclude:
conditions.append(~Q(**{k:v}))