if last week is break it exteds until we have content

This commit is contained in:
j 2025-01-31 16:40:00 +05:30
commit 270200cac3

View file

@ -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: