diff --git a/app/item/models.py b/app/item/models.py index 7c3ef1b..dbd6fe3 100644 --- a/app/item/models.py +++ b/app/item/models.py @@ -312,10 +312,13 @@ class Week(models.Model): items, _ = Item.public(monday) return items.order_by('published') - def background(self, now=None): + def background(self, now=None, order_by=None): if self.use_hue: colors = [] - for item in self.items(): + items = self.items() + if order_by: + items = items.order_by(order_by) + for item in items: if now and item.published >= now: continue color = item.get_hue(update=True) diff --git a/app/item/views.py b/app/item/views.py index 1fced1d..9995937 100644 --- a/app/item/views.py +++ b/app/item/views.py @@ -76,7 +76,7 @@ def index(request): context['items'] = week extra = models.Week.objects.filter(monday=monday, is_break=False).first() if extra: - context['week_background'] = extra.background(now) + context['week_background'] = extra.background(now, '-published') if now: context['now'] = now context['previous_week'] = (now - timedelta(days=7)).strftime(TS_FORMAT)