itemKey type list

This commit is contained in:
j 2011-11-10 17:53:12 +00:00
parent fbcec1bf18
commit f2d32a7121
3 changed files with 7 additions and 6 deletions

View file

@ -455,11 +455,12 @@
{
"id": "rightslevel",
"title": "Rights Level",
"type": "label",
"type": "list",
"columnWidth": 90,
"format": {"type": "ColorLevel", "args": [
["Public", "Relaxed", "Regular", "Restricted", "Private"]
]},
"list": ["Public", "Relaxed", "Regular", "Restricted", "Private"],
"sortOperator": "+"
},
{

View file

@ -52,7 +52,7 @@ def parseCondition(condition, user):
'layer': 'string',
}.get(key_type, key_type)
if k == 'list':
key_type = 'list'
key_type = ''
if (not exclude and op == '=' or op in ('$', '^')) and v == '':
return Q()
@ -124,7 +124,7 @@ def parseCondition(condition, user):
if exclude:
q = ~q
return q
elif key_type == 'list':
elif k == 'list':
q = Q(id=0)
l = v.split(":")
if len(l) >= 2:
@ -164,7 +164,7 @@ def parseCondition(condition, user):
if exclude:
q = ~q
return q
else: #numbers
else: #integer, float, list, time
#use sort table here
if key_type == 'time':
v = int(utils.parse_time(v))

View file

@ -1156,7 +1156,7 @@ attrs = {
'item': models.OneToOneField('Item', related_name='sort', primary_key=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 = {'id': 'itemId'}.get(name, name)
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',
'hue': 'float',
'time': 'integer',
'label': 'integer',
'list': 'integer',
}.get(sort_type, sort_type)]
attrs[name] = model[0](**model[1])