forked from 0x2620/pandora
use annotation find value
This commit is contained in:
parent
e673e26c53
commit
28a577d69f
4 changed files with 5 additions and 4 deletions
|
@ -26,6 +26,7 @@ def parseCondition(condition, user):
|
||||||
'in': 'start',
|
'in': 'start',
|
||||||
'out': 'end',
|
'out': 'end',
|
||||||
'id': 'public_id',
|
'id': 'public_id',
|
||||||
|
'value': 'findvalue',
|
||||||
}.get(k, k)
|
}.get(k, k)
|
||||||
if not k:
|
if not k:
|
||||||
k = 'name'
|
k = 'name'
|
||||||
|
|
|
@ -27,7 +27,7 @@ def parseCondition(condition, user):
|
||||||
'in': 'start',
|
'in': 'start',
|
||||||
'out': 'end',
|
'out': 'end',
|
||||||
'place': 'annotations__places__id',
|
'place': 'annotations__places__id',
|
||||||
'text': 'annotations__value',
|
'text': 'annotations__findvalue',
|
||||||
'user': 'annotations__user__username',
|
'user': 'annotations__user__username',
|
||||||
}.get(k, k)
|
}.get(k, k)
|
||||||
if not k:
|
if not k:
|
||||||
|
@ -40,7 +40,7 @@ def parseCondition(condition, user):
|
||||||
for l in filter(lambda l: not l.get('private', False),
|
for l in filter(lambda l: not l.get('private', False),
|
||||||
settings.CONFIG['layers'])]
|
settings.CONFIG['layers'])]
|
||||||
if k in public_layers:
|
if k in public_layers:
|
||||||
return parseCondition({'key': 'annotations__value',
|
return parseCondition({'key': 'annotations__findvalue',
|
||||||
'value': v,
|
'value': v,
|
||||||
'operator': op}, user) \
|
'operator': op}, user) \
|
||||||
& parseCondition({'key': 'annotations__layer',
|
& parseCondition({'key': 'annotations__layer',
|
||||||
|
|
|
@ -48,7 +48,7 @@ def order_query(qs, sort):
|
||||||
if key.startswith('clip:'):
|
if key.startswith('clip:'):
|
||||||
key = e['key'][len('clip:'):]
|
key = e['key'][len('clip:'):]
|
||||||
key = {
|
key = {
|
||||||
'text': 'annotations__value',
|
'text': 'annotations__sortvalue',
|
||||||
'position': 'start',
|
'position': 'start',
|
||||||
}.get(key, key)
|
}.get(key, key)
|
||||||
elif key not in clip_keys:
|
elif key not in clip_keys:
|
||||||
|
|
|
@ -44,7 +44,7 @@ def sort_string(string):
|
||||||
|
|
||||||
#pad numbered titles
|
#pad numbered titles
|
||||||
string = re.sub('(\d+)', lambda x: '%010d' % int(x.group(0)), string)
|
string = re.sub('(\d+)', lambda x: '%010d' % int(x.group(0)), string)
|
||||||
return unicodedata.normalize('NFKD', string).lower()
|
return unicodedata.normalize('NFKD', string)
|
||||||
|
|
||||||
|
|
||||||
def sort_title(title):
|
def sort_title(title):
|
||||||
|
|
Loading…
Reference in a new issue