pad ids to len 7 for storage
This commit is contained in:
parent
28a577d69f
commit
d070cb616b
3 changed files with 4 additions and 3 deletions
|
@ -111,7 +111,7 @@ def findClips(request):
|
|||
Annotation.objects.filter(layer=layer, clip__in=ids))
|
||||
elif 'position' in query:
|
||||
qs = order_query(qs, query['sort'])
|
||||
ids = [i.public_id for i in qs]
|
||||
ids = [i['public_id'] for i in qs.values('public_id')]
|
||||
data['conditions'] = data['conditions'] + {
|
||||
'value': data['position'],
|
||||
'key': query['sort'][0]['key'],
|
||||
|
@ -123,7 +123,7 @@ def findClips(request):
|
|||
response['data']['position'] = utils.get_positions(ids, [qs[0].itemId])[0]
|
||||
elif 'positions' in data:
|
||||
qs = order_query(qs, query['sort'])
|
||||
ids = [i.public_id for i in qs]
|
||||
ids = [i['public_id'] for i in qs.values('public_id')]
|
||||
response['data']['positions'] = utils.get_positions(ids, data['positions'])
|
||||
else:
|
||||
response['data']['items'] = qs.count()
|
||||
|
|
|
@ -772,6 +772,7 @@ class Item(models.Model):
|
|||
|
||||
def path(self, name=''):
|
||||
h = self.itemId
|
||||
h = (7-len(h))*'0' + h
|
||||
return os.path.join('items', h[:2], h[2:4], h[4:6], h[6:], name)
|
||||
|
||||
'''
|
||||
|
|
|
@ -122,7 +122,7 @@ class List(models.Model):
|
|||
return response
|
||||
|
||||
def path(self, name=''):
|
||||
h = "%06d" % self.id
|
||||
h = "%07d" % self.id
|
||||
return os.path.join('lists', h[:2], h[2:4], h[4:6], h[6:], name)
|
||||
|
||||
def update_icon(self):
|
||||
|
|
Loading…
Reference in a new issue