From 270200cac31e06e766a0396fb97919be12517bd0 Mon Sep 17 00:00:00 2001 From: j Date: Fri, 31 Jan 2025 16:40:00 +0530 Subject: [PATCH] if last week is break it exteds until we have content --- app/item/models.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/item/models.py b/app/item/models.py index f086019..73fb505 100644 --- a/app/item/models.py +++ b/app/item/models.py @@ -83,6 +83,9 @@ class Item(models.Model): elif not first_post: while qs.exists() and not first_post: monday = monday - timedelta(days=7) + 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() week = qs.filter(published__gt=monday) else: