fix icon for dynamic lists
This commit is contained in:
parent
4174a8a2c7
commit
1fa04cec95
1 changed files with 10 additions and 6 deletions
|
@ -57,12 +57,15 @@ class List(models.Model):
|
||||||
self.items_sum = self.get_items_sum(self.user)
|
self.items_sum = self.get_items_sum(self.user)
|
||||||
super(List, self).save(*args, **kwargs)
|
super(List, self).save(*args, **kwargs)
|
||||||
|
|
||||||
def get_items_sum(self, user=None):
|
def get_items(self, user=None):
|
||||||
if self.query.get('static', False):
|
if self.query.get('static', False):
|
||||||
return self.items.count()
|
return self.items
|
||||||
else:
|
|
||||||
from item.models import Item
|
from item.models import Item
|
||||||
return Item.objects.find({'query': self.query}, user).count()
|
return Item.objects.find({'query': self.query}, user)
|
||||||
|
|
||||||
|
|
||||||
|
def get_items_sum(self, user=None):
|
||||||
|
return self.get_items(user).count()
|
||||||
|
|
||||||
def add(self, item):
|
def add(self, item):
|
||||||
q = self.items.filter(id=item.id)
|
q = self.items.filter(id=item.id)
|
||||||
|
@ -119,7 +122,8 @@ class List(models.Model):
|
||||||
def update_icon(self):
|
def update_icon(self):
|
||||||
frames = []
|
frames = []
|
||||||
for i in self.poster_frames:
|
for i in self.poster_frames:
|
||||||
qs = self.items.filter(itemId=i['item'])
|
from item.models import Item
|
||||||
|
qs = Item.objects.filter(itemId=i['item'])
|
||||||
if qs.count() > 0:
|
if qs.count() > 0:
|
||||||
frame = qs[0].frame(i['position'])
|
frame = qs[0].frame(i['position'])
|
||||||
if frame:
|
if frame:
|
||||||
|
|
Loading…
Reference in a new issue