shift current week

This commit is contained in:
j 2023-08-14 14:10:30 +02:00
commit 19b9f72ed9
4 changed files with 32 additions and 4 deletions

View file

@ -57,8 +57,9 @@ class Item(models.Model):
return json.dumps(comments)
@classmethod
def public(cls):
now = timezone.now()
def public(cls, now=None):
if now is None:
now = timezone.now()
qs = cls.objects.exclude(published=None).filter(published__lte=now).order_by('-published')
cal = now.date().isocalendar()
monday = now.date() - timedelta(days=now.date().isocalendar().weekday - 1)