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)
|
conn.append(q)
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
if condition.get('value', '') != '' or \
|
|
||||||
condition.get('operator', '') == '=':
|
|
||||||
conn.append(parseCondition(condition, user))
|
conn.append(parseCondition(condition, user))
|
||||||
if conn:
|
if conn:
|
||||||
q = conn[0]
|
q = conn[0]
|
||||||
|
|
|
@ -46,8 +46,6 @@ def parseConditions(conditions, operator, user):
|
||||||
conn.append(q)
|
conn.append(q)
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
if condition.get('value', '') != '' or \
|
|
||||||
condition.get('operator', '') == '=':
|
|
||||||
conn.append(parseCondition(condition, user))
|
conn.append(parseCondition(condition, user))
|
||||||
if conn:
|
if conn:
|
||||||
q = conn[0]
|
q = conn[0]
|
||||||
|
|
|
@ -166,8 +166,6 @@ def parseConditions(conditions, operator):
|
||||||
conn.append(q)
|
conn.append(q)
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
if condition.get('value', '') != '' or \
|
|
||||||
condition.get('operator', '') == '=':
|
|
||||||
conn.append(parseCondition(condition))
|
conn.append(parseCondition(condition))
|
||||||
if conn:
|
if conn:
|
||||||
q = conn[0]
|
q = conn[0]
|
||||||
|
|
|
@ -10,6 +10,7 @@ import models
|
||||||
def parseCondition(condition, user):
|
def parseCondition(condition, user):
|
||||||
'''
|
'''
|
||||||
'''
|
'''
|
||||||
|
print condition, user
|
||||||
k = condition.get('key', 'name')
|
k = condition.get('key', 'name')
|
||||||
k = {
|
k = {
|
||||||
'user': 'user__username',
|
'user': 'user__username',
|
||||||
|
@ -20,7 +21,7 @@ def parseCondition(condition, user):
|
||||||
v = condition['value']
|
v = condition['value']
|
||||||
op = condition.get('operator')
|
op = condition.get('operator')
|
||||||
if not op:
|
if not op:
|
||||||
op = ''
|
op = '='
|
||||||
if op.startswith('!'):
|
if op.startswith('!'):
|
||||||
op = op[1:]
|
op = op[1:]
|
||||||
exclude = True
|
exclude = True
|
||||||
|
@ -45,7 +46,6 @@ def parseCondition(condition, user):
|
||||||
'^': '__istartswith',
|
'^': '__istartswith',
|
||||||
'$': '__iendswith',
|
'$': '__iendswith',
|
||||||
}.get(op, '__icontains'))
|
}.get(op, '__icontains'))
|
||||||
|
|
||||||
key = str(key)
|
key = str(key)
|
||||||
if exclude:
|
if exclude:
|
||||||
q = ~Q(**{key: v})
|
q = ~Q(**{key: v})
|
||||||
|
@ -81,8 +81,6 @@ def parseConditions(conditions, operator, user):
|
||||||
conn.append(q)
|
conn.append(q)
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
if condition.get('value', '') != '' or \
|
|
||||||
condition.get('operator', '') == '=':
|
|
||||||
conn.append(parseCondition(condition, user))
|
conn.append(parseCondition(condition, user))
|
||||||
if conn:
|
if conn:
|
||||||
q = conn[0]
|
q = conn[0]
|
||||||
|
|
|
@ -96,7 +96,6 @@ def findLists(request):
|
||||||
else:
|
else:
|
||||||
qs = _order_query(query['qs'], query['sort'])
|
qs = _order_query(query['qs'], query['sort'])
|
||||||
|
|
||||||
qs = qs.distinct()
|
|
||||||
response = json_response()
|
response = json_response()
|
||||||
if 'keys' in data:
|
if 'keys' in data:
|
||||||
qs = qs[query['range'][0]:query['range'][1]]
|
qs = qs[query['range'][0]:query['range'][1]]
|
||||||
|
|
|
@ -92,8 +92,6 @@ def parseConditions(conditions, operator, user):
|
||||||
conn.append(q)
|
conn.append(q)
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
if condition.get('value', '') != '' or \
|
|
||||||
condition.get('operator', '') == '=':
|
|
||||||
conn.append(parseCondition(condition, user))
|
conn.append(parseCondition(condition, user))
|
||||||
if conn:
|
if conn:
|
||||||
q = conn[0]
|
q = conn[0]
|
||||||
|
|
|
@ -47,8 +47,6 @@ def parseConditions(conditions, operator, user):
|
||||||
conn.append(q)
|
conn.append(q)
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
if condition.get('value', '') != '' or \
|
|
||||||
condition.get('operator', '') == '=':
|
|
||||||
conn.append(parseCondition(condition, user))
|
conn.append(parseCondition(condition, user))
|
||||||
if conn:
|
if conn:
|
||||||
q = conn[0]
|
q = conn[0]
|
||||||
|
|
Loading…
Reference in a new issue