diff --git a/app/item/models.py b/app/item/models.py index d514aca..a238ae7 100644 --- a/app/item/models.py +++ b/app/item/models.py @@ -59,11 +59,12 @@ class Item(models.Model): @classmethod def public(cls, now=None): if now is None: - now = timezone.now() + now = timezone.make_aware(datetime.now(), timezone.get_default_timezone()) 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) monday = timezone.datetime(monday.year, monday.month, monday.day, tzinfo=now.tzinfo) + print(monday) first_post = qs.filter(published__gt=monday).first() if first_post and first_post.published < now: week = qs.filter(published__gt=monday)