weeks can be breaks
This commit is contained in:
parent
e44e8b3c35
commit
92460179f5
5 changed files with 57 additions and 12 deletions
|
|
@ -74,6 +74,9 @@ class Item(models.Model):
|
|||
cal = now.date().isocalendar()
|
||||
monday = now.date() - timedelta(days=now.date().isocalendar().weekday - 1)
|
||||
monday = timezone.datetime(monday.year, monday.month, monday.day, tzinfo=now.tzinfo)
|
||||
current_week = Week.objects.filter(monday=monday).first()
|
||||
if current_week and current_week.is_break:
|
||||
return current_week, qs
|
||||
first_post = qs.filter(published__gt=monday).first()
|
||||
if first_post and first_post.published < now:
|
||||
week = qs.filter(published__gt=monday)
|
||||
|
|
@ -192,6 +195,8 @@ class Week(models.Model):
|
|||
title = models.CharField(max_length=2048, blank=True, default="")
|
||||
byline = models.CharField(max_length=2048, blank=True, default="")
|
||||
published = models.DateTimeField(null=True, default=None, blank=True, editable=False)
|
||||
is_break = models.BooleanField(default=False)
|
||||
break_notice = models.TextField(default="", blank=True)
|
||||
|
||||
def __str__(self):
|
||||
return "%s (%s)" % (self.title, self.monday)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue