forked from 0x2620/pandora
dont filter empty conditions
This commit is contained in:
parent
1d894fc934
commit
7982ba6b29
7 changed files with 8 additions and 21 deletions
|
@ -96,8 +96,6 @@ def parseConditions(conditions, operator, user):
|
|||
conn.append(q)
|
||||
pass
|
||||
else:
|
||||
if condition.get('value', '') != '' or \
|
||||
condition.get('operator', '') == '=':
|
||||
conn.append(parseCondition(condition, user))
|
||||
if conn:
|
||||
q = conn[0]
|
||||
|
|
|
@ -46,8 +46,6 @@ def parseConditions(conditions, operator, user):
|
|||
conn.append(q)
|
||||
pass
|
||||
else:
|
||||
if condition.get('value', '') != '' or \
|
||||
condition.get('operator', '') == '=':
|
||||
conn.append(parseCondition(condition, user))
|
||||
if conn:
|
||||
q = conn[0]
|
||||
|
|
|
@ -166,8 +166,6 @@ def parseConditions(conditions, operator):
|
|||
conn.append(q)
|
||||
pass
|
||||
else:
|
||||
if condition.get('value', '') != '' or \
|
||||
condition.get('operator', '') == '=':
|
||||
conn.append(parseCondition(condition))
|
||||
if conn:
|
||||
q = conn[0]
|
||||
|
|
|
@ -10,6 +10,7 @@ import models
|
|||
def parseCondition(condition, user):
|
||||
'''
|
||||
'''
|
||||
print condition, user
|
||||
k = condition.get('key', 'name')
|
||||
k = {
|
||||
'user': 'user__username',
|
||||
|
@ -20,7 +21,7 @@ def parseCondition(condition, user):
|
|||
v = condition['value']
|
||||
op = condition.get('operator')
|
||||
if not op:
|
||||
op = ''
|
||||
op = '='
|
||||
if op.startswith('!'):
|
||||
op = op[1:]
|
||||
exclude = True
|
||||
|
@ -45,7 +46,6 @@ def parseCondition(condition, user):
|
|||
'^': '__istartswith',
|
||||
'$': '__iendswith',
|
||||
}.get(op, '__icontains'))
|
||||
|
||||
key = str(key)
|
||||
if exclude:
|
||||
q = ~Q(**{key: v})
|
||||
|
@ -81,8 +81,6 @@ def parseConditions(conditions, operator, user):
|
|||
conn.append(q)
|
||||
pass
|
||||
else:
|
||||
if condition.get('value', '') != '' or \
|
||||
condition.get('operator', '') == '=':
|
||||
conn.append(parseCondition(condition, user))
|
||||
if conn:
|
||||
q = conn[0]
|
||||
|
|
|
@ -96,7 +96,6 @@ def findLists(request):
|
|||
else:
|
||||
qs = _order_query(query['qs'], query['sort'])
|
||||
|
||||
qs = qs.distinct()
|
||||
response = json_response()
|
||||
if 'keys' in data:
|
||||
qs = qs[query['range'][0]:query['range'][1]]
|
||||
|
|
|
@ -92,8 +92,6 @@ def parseConditions(conditions, operator, user):
|
|||
conn.append(q)
|
||||
pass
|
||||
else:
|
||||
if condition.get('value', '') != '' or \
|
||||
condition.get('operator', '') == '=':
|
||||
conn.append(parseCondition(condition, user))
|
||||
if conn:
|
||||
q = conn[0]
|
||||
|
|
|
@ -47,8 +47,6 @@ def parseConditions(conditions, operator, user):
|
|||
conn.append(q)
|
||||
pass
|
||||
else:
|
||||
if condition.get('value', '') != '' or \
|
||||
condition.get('operator', '') == '=':
|
||||
conn.append(parseCondition(condition, user))
|
||||
if conn:
|
||||
q = conn[0]
|
||||
|
|
Loading…
Reference in a new issue