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