fix index order
This commit is contained in:
parent
99882e78ae
commit
41c1b1cdec
2 changed files with 6 additions and 3 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue