dont filter empty conditions

This commit is contained in:
j 2011-09-28 18:00:13 +00:00
parent 1d894fc934
commit 7982ba6b29
7 changed files with 8 additions and 21 deletions

View file

@ -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]

View file

@ -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]

View file

@ -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]

View file

@ -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]

View file

@ -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]]

View file

@ -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]

View file

@ -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]