forked from 0x2620/pandora
use instance name if possible
This commit is contained in:
parent
c7eb267f15
commit
224055c7bb
2 changed files with 4 additions and 2 deletions
|
@ -297,6 +297,7 @@ class File(models.Model):
|
||||||
return 'unknown'
|
return 'unknown'
|
||||||
|
|
||||||
def get_instance(self):
|
def get_instance(self):
|
||||||
|
#FIXME: what about other instances?
|
||||||
if self.instances.all().count() > 0:
|
if self.instances.all().count() > 0:
|
||||||
return self.instances.all()[0]
|
return self.instances.all()[0]
|
||||||
return None
|
return None
|
||||||
|
@ -318,7 +319,8 @@ class File(models.Model):
|
||||||
return u''
|
return u''
|
||||||
|
|
||||||
def get_name(self):
|
def get_name(self):
|
||||||
if self.is_extra:
|
instance = self.get_instance()
|
||||||
|
if instance:
|
||||||
return self.get_instance().name
|
return self.get_instance().name
|
||||||
if self.item:
|
if self.item:
|
||||||
name = self.item.get('title', 'Untitled')
|
name = self.item.get('title', 'Untitled')
|
||||||
|
|
|
@ -226,7 +226,7 @@ Positions
|
||||||
response['data']['items'] = [only_p(m['json']) for m in qs.values('json')]
|
response['data']['items'] = [only_p(m['json']) for m in qs.values('json')]
|
||||||
else: # otherwise stats
|
else: # otherwise stats
|
||||||
items = query['qs']
|
items = query['qs']
|
||||||
files = File.objects.all().filter(item__in=items).filter(size__gt=0)
|
files = File.objects.filter(item__in=items).filter(size__gt=0)
|
||||||
r = files.aggregate(
|
r = files.aggregate(
|
||||||
Sum('duration'),
|
Sum('duration'),
|
||||||
Sum('pixels'),
|
Sum('pixels'),
|
||||||
|
|
Loading…
Reference in a new issue