forked from 0x2620/pandora
always use get_operator, avoid case-insensitive match if possible
This commit is contained in:
parent
5b545e6e43
commit
e9863c238e
24 changed files with 289 additions and 370 deletions
36
pandora/oxdjango/managers.py
Normal file
36
pandora/oxdjango/managers.py
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
|
||||
def get_operator(op, type='str'):
|
||||
return {
|
||||
'str': {
|
||||
'==': '',
|
||||
'===': '',
|
||||
'>': '__gt',
|
||||
'>=': '__gte',
|
||||
'<': '__lt',
|
||||
'<=': '__lte',
|
||||
'^': '__startswith',
|
||||
'$': '__endswith',
|
||||
},
|
||||
'istr': {
|
||||
'==': '__iexact',
|
||||
'===': '',
|
||||
'>': '__gt',
|
||||
'>=': '__gte',
|
||||
'<': '__lt',
|
||||
'<=': '__lte',
|
||||
'^': '__istartswith',
|
||||
'$': '__iendswith',
|
||||
},
|
||||
'int': {
|
||||
'==': '',
|
||||
'>': '__gt',
|
||||
'>=': '__gte',
|
||||
'<': '__lt',
|
||||
'<=': '__lte',
|
||||
}
|
||||
}[type].get(op, {
|
||||
'str': '__contains',
|
||||
'istr': '__icontains',
|
||||
'int': ''
|
||||
}[type])
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue