dont filter empty conditions
This commit is contained in:
parent
1d894fc934
commit
7982ba6b29
7 changed files with 8 additions and 21 deletions
|
@ -96,9 +96,7 @@ def parseConditions(conditions, operator, user):
|
|||
conn.append(q)
|
||||
pass
|
||||
else:
|
||||
if condition.get('value', '') != '' or \
|
||||
condition.get('operator', '') == '=':
|
||||
conn.append(parseCondition(condition, user))
|
||||
conn.append(parseCondition(condition, user))
|
||||
if conn:
|
||||
q = conn[0]
|
||||
for c in conn[1:]:
|
||||
|
|
|
@ -46,9 +46,7 @@ def parseConditions(conditions, operator, user):
|
|||
conn.append(q)
|
||||
pass
|
||||
else:
|
||||
if condition.get('value', '') != '' or \
|
||||
condition.get('operator', '') == '=':
|
||||
conn.append(parseCondition(condition, user))
|
||||
conn.append(parseCondition(condition, user))
|
||||
if conn:
|
||||
q = conn[0]
|
||||
for c in conn[1:]:
|
||||
|
|
|
@ -166,9 +166,7 @@ def parseConditions(conditions, operator):
|
|||
conn.append(q)
|
||||
pass
|
||||
else:
|
||||
if condition.get('value', '') != '' or \
|
||||
condition.get('operator', '') == '=':
|
||||
conn.append(parseCondition(condition))
|
||||
conn.append(parseCondition(condition))
|
||||
if conn:
|
||||
q = conn[0]
|
||||
for c in conn[1:]:
|
||||
|
|
|
@ -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,9 +81,7 @@ def parseConditions(conditions, operator, user):
|
|||
conn.append(q)
|
||||
pass
|
||||
else:
|
||||
if condition.get('value', '') != '' or \
|
||||
condition.get('operator', '') == '=':
|
||||
conn.append(parseCondition(condition, user))
|
||||
conn.append(parseCondition(condition, user))
|
||||
if conn:
|
||||
q = conn[0]
|
||||
for c in conn[1:]:
|
||||
|
|
|
@ -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,9 +92,7 @@ def parseConditions(conditions, operator, user):
|
|||
conn.append(q)
|
||||
pass
|
||||
else:
|
||||
if condition.get('value', '') != '' or \
|
||||
condition.get('operator', '') == '=':
|
||||
conn.append(parseCondition(condition, user))
|
||||
conn.append(parseCondition(condition, user))
|
||||
if conn:
|
||||
q = conn[0]
|
||||
for c in conn[1:]:
|
||||
|
|
|
@ -47,9 +47,7 @@ def parseConditions(conditions, operator, user):
|
|||
conn.append(q)
|
||||
pass
|
||||
else:
|
||||
if condition.get('value', '') != '' or \
|
||||
condition.get('operator', '') == '=':
|
||||
conn.append(parseCondition(condition, user))
|
||||
conn.append(parseCondition(condition, user))
|
||||
if conn:
|
||||
q = conn[0]
|
||||
for c in conn[1:]:
|
||||
|
|
Loading…
Reference in a new issue