forked from 0x2620/pandora
fix find for numbers and dates
This commit is contained in:
parent
f1d4d5da63
commit
d48bb4f535
1 changed files with 16 additions and 16 deletions
|
@ -88,35 +88,35 @@ def parseCondition(condition):
|
||||||
v1 = parseDate(v1.split('.'))
|
v1 = parseDate(v1.split('.'))
|
||||||
v2 = parseDate(v2.split('.'))
|
v2 = parseDate(v2.split('.'))
|
||||||
|
|
||||||
k = 'find__%s' % k
|
|
||||||
if exclude: #!1960-1970
|
if exclude: #!1960-1970
|
||||||
k1 = str('%s__lt' % k)
|
k1 = 'value__lt'
|
||||||
k2 = str('%s__gte' % k)
|
k2 = 'value__gte'
|
||||||
return Q(**{k1:v1})|Q(**{k2:v2})
|
return Q(**{'find__key': k, k1:v1})|Q(**{'find__key': k, k2:v2})
|
||||||
else: #1960-1970
|
else: #1960-1970
|
||||||
k1 = str('%s__gte' % k)
|
k1 = 'value__gte'
|
||||||
k2 = str('%s__lt' % k)
|
k2 = 'value__lt'
|
||||||
return Q(**{k1:v1})&Q(**{k2:v2})
|
return Q(**{'find__key': k, k1:v1})&Q(**{'find__key': k, k2:v2})
|
||||||
else:
|
else:
|
||||||
if keyType(k) == "date":
|
if keyType(k) == "date":
|
||||||
v = parseDate(v.split('.'))
|
v = parseDate(v.split('.'))
|
||||||
if op == '=':
|
if op == '=':
|
||||||
k = '%s__exact' % k
|
vk = 'value__exact'
|
||||||
elif op == '>':
|
elif op == '>':
|
||||||
k = '%s__gt' % k
|
vk = 'value__gt'
|
||||||
elif op == '>=':
|
elif op == '>=':
|
||||||
k = '%s__gte' % k
|
vk = 'value__gte'
|
||||||
elif op == '<':
|
elif op == '<':
|
||||||
k = '%s__lt' % k
|
vk = 'value__lt'
|
||||||
elif op == '<=':
|
elif op == '<=':
|
||||||
k = '%s__lte' % k
|
vk = 'value__lte'
|
||||||
|
|
||||||
|
vk = 'find__%s' % vk
|
||||||
|
vk = str(vk)
|
||||||
|
|
||||||
k = 'find__%s' % k
|
|
||||||
k = str(k)
|
|
||||||
if exclude: #!1960
|
if exclude: #!1960
|
||||||
return ~Q(**{k:v})
|
return ~Q(**{'find__key': k, vk:v})
|
||||||
else: #1960
|
else: #1960
|
||||||
return Q(**{k:v})
|
return Q(**{'find__key': k, vk:v})
|
||||||
|
|
||||||
def parseConditions(conditions, operator):
|
def parseConditions(conditions, operator):
|
||||||
'''
|
'''
|
||||||
|
|
Loading…
Reference in a new issue