ignore noop conditions, return descriptions, itemlist/items, update selected frame after uploading frames
This commit is contained in:
parent
de52b3966d
commit
e41a23e1d4
4 changed files with 9 additions and 3 deletions
|
@ -256,6 +256,7 @@ class File(models.Model):
|
|||
return False
|
||||
|
||||
def json(self, keys=None, user=None):
|
||||
#FIXME: why?
|
||||
if keys and not 'instances' in keys:
|
||||
keys.append('instances')
|
||||
resolution = (self.width, self.height)
|
||||
|
|
|
@ -146,6 +146,7 @@ def upload(request):
|
|||
position = float(os.path.splitext(name)[0])
|
||||
fr, created = models.Frame.objects.get_or_create(file=f, position=position)
|
||||
fr.frame.save(name, frame)
|
||||
f.item.select_frame()
|
||||
else:
|
||||
response = json_response(status=403, text='permissino denied')
|
||||
if 'file' in request.FILES:
|
||||
|
@ -469,6 +470,8 @@ Positions
|
|||
}
|
||||
'''
|
||||
data = json.loads(request.POST['data'])
|
||||
if not data.get('sort'):
|
||||
data['sort'] = [{'key': 'path', 'operator': '+'}]
|
||||
query = parse_query(data, request.user)
|
||||
|
||||
response = json_response({})
|
||||
|
|
|
@ -45,6 +45,9 @@ def parseCondition(condition, user):
|
|||
else:
|
||||
return q
|
||||
|
||||
if (not exclude and op == '=' or op in ('$', '^')) and v == '':
|
||||
return Q(True)
|
||||
|
||||
if k == 'filename' and (user.is_anonymous() or \
|
||||
not user.get_profile().capability('canSeeFiles')):
|
||||
return Q(id=0)
|
||||
|
@ -112,7 +115,7 @@ def parseCondition(condition, user):
|
|||
q = Q(**{value_key: v})
|
||||
return q
|
||||
elif key_type == 'list':
|
||||
q = Q(itemId=False)
|
||||
q = Q(id=0)
|
||||
l = v.split(":")
|
||||
if len(l) >= 2:
|
||||
l = (l[0], ":".join(l[1:]))
|
||||
|
@ -185,7 +188,6 @@ def parseConditions(conditions, operator, user):
|
|||
condition.get('operator', '&'), user)
|
||||
if q:
|
||||
conn.append(q)
|
||||
pass
|
||||
else:
|
||||
conn.append(parseCondition(condition, user))
|
||||
if conn:
|
||||
|
|
|
@ -31,7 +31,7 @@ def _order_query(qs, sort):
|
|||
operator = ''
|
||||
key = {
|
||||
'subscribed': 'subscribed_users',
|
||||
'items': 'items_sum'
|
||||
'items': 'numberofitems'
|
||||
}.get(e['key'], e['key'])
|
||||
order = '%s%s' % (operator, key)
|
||||
order_by.append(order)
|
||||
|
|
Loading…
Reference in a new issue