forked from 0x2620/pandora
itemKey type list
This commit is contained in:
parent
fbcec1bf18
commit
f2d32a7121
3 changed files with 7 additions and 6 deletions
|
@ -455,11 +455,12 @@
|
||||||
{
|
{
|
||||||
"id": "rightslevel",
|
"id": "rightslevel",
|
||||||
"title": "Rights Level",
|
"title": "Rights Level",
|
||||||
"type": "label",
|
"type": "list",
|
||||||
"columnWidth": 90,
|
"columnWidth": 90,
|
||||||
"format": {"type": "ColorLevel", "args": [
|
"format": {"type": "ColorLevel", "args": [
|
||||||
["Public", "Relaxed", "Regular", "Restricted", "Private"]
|
["Public", "Relaxed", "Regular", "Restricted", "Private"]
|
||||||
]},
|
]},
|
||||||
|
"list": ["Public", "Relaxed", "Regular", "Restricted", "Private"],
|
||||||
"sortOperator": "+"
|
"sortOperator": "+"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -52,7 +52,7 @@ def parseCondition(condition, user):
|
||||||
'layer': 'string',
|
'layer': 'string',
|
||||||
}.get(key_type, key_type)
|
}.get(key_type, key_type)
|
||||||
if k == 'list':
|
if k == 'list':
|
||||||
key_type = 'list'
|
key_type = ''
|
||||||
|
|
||||||
if (not exclude and op == '=' or op in ('$', '^')) and v == '':
|
if (not exclude and op == '=' or op in ('$', '^')) and v == '':
|
||||||
return Q()
|
return Q()
|
||||||
|
@ -124,7 +124,7 @@ def parseCondition(condition, user):
|
||||||
if exclude:
|
if exclude:
|
||||||
q = ~q
|
q = ~q
|
||||||
return q
|
return q
|
||||||
elif key_type == 'list':
|
elif k == 'list':
|
||||||
q = Q(id=0)
|
q = Q(id=0)
|
||||||
l = v.split(":")
|
l = v.split(":")
|
||||||
if len(l) >= 2:
|
if len(l) >= 2:
|
||||||
|
@ -164,7 +164,7 @@ def parseCondition(condition, user):
|
||||||
if exclude:
|
if exclude:
|
||||||
q = ~q
|
q = ~q
|
||||||
return q
|
return q
|
||||||
else: #numbers
|
else: #integer, float, list, time
|
||||||
#use sort table here
|
#use sort table here
|
||||||
if key_type == 'time':
|
if key_type == 'time':
|
||||||
v = int(utils.parse_time(v))
|
v = int(utils.parse_time(v))
|
||||||
|
|
|
@ -1156,7 +1156,7 @@ attrs = {
|
||||||
'item': models.OneToOneField('Item', related_name='sort', primary_key=True),
|
'item': models.OneToOneField('Item', related_name='sort', primary_key=True),
|
||||||
'duration': models.FloatField(null=True, blank=True, db_index=True),
|
'duration': models.FloatField(null=True, blank=True, db_index=True),
|
||||||
}
|
}
|
||||||
for key in filter(lambda k: 'columnWidth' in k or k['type'] in ('integer', 'time', 'float', 'data'), settings.CONFIG['itemKeys']):
|
for key in filter(lambda k: 'columnWidth' in k or k['type'] in ('integer', 'time', 'float', 'date', 'list'), settings.CONFIG['itemKeys']):
|
||||||
name = key['id']
|
name = key['id']
|
||||||
name = {'id': 'itemId'}.get(name, name)
|
name = {'id': 'itemId'}.get(name, name)
|
||||||
sort_type = key.get('sort', key['type'])
|
sort_type = key.get('sort', key['type'])
|
||||||
|
@ -1178,7 +1178,7 @@ for key in filter(lambda k: 'columnWidth' in k or k['type'] in ('integer', 'time
|
||||||
'date': 'date',
|
'date': 'date',
|
||||||
'hue': 'float',
|
'hue': 'float',
|
||||||
'time': 'integer',
|
'time': 'integer',
|
||||||
'label': 'integer',
|
'list': 'integer',
|
||||||
}.get(sort_type, sort_type)]
|
}.get(sort_type, sort_type)]
|
||||||
attrs[name] = model[0](**model[1])
|
attrs[name] = model[0](**model[1])
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue