diff --git a/app/item/models.py b/app/item/models.py index 8609dc8..dee6142 100644 --- a/app/item/models.py +++ b/app/item/models.py @@ -7,7 +7,6 @@ import lxml.html from django.conf import settings from django.contrib.auth import get_user_model from django.db import models -from django.db.models.functions import ExtractWeek, ExtractYear from django.urls import reverse from django.utils.timesince import timesince @@ -65,6 +64,7 @@ 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) + print(monday) first_post = qs.filter(published__gt=monday).first() if first_post and first_post.published < now: week = qs.filter(published__gt=monday) @@ -76,11 +76,7 @@ class Item(models.Model): else: last_monday = monday - timedelta(days=7) week = qs.filter(published__gt=last_monday) - archive = (qs - .exclude(id__in=week) - .annotate(year=ExtractYear('published')) - .annotate(week=ExtractWeek('published')) - ) + archive = qs.exclude(id__in=week) return week, archive def get_absolute_url(self): diff --git a/app/item/tasks.py b/app/item/tasks.py index bf4f7aa..06f29d6 100644 --- a/app/item/tasks.py +++ b/app/item/tasks.py @@ -8,7 +8,6 @@ from django.conf import settings from django.utils import timezone from ..signalbot import rpc -from ..telegrambot import rpc as telegram_rpc from ..celery import app from . import models diff --git a/app/templates/archive.html b/app/templates/archive.html index d1a1884..2207109 100644 --- a/app/templates/archive.html +++ b/app/templates/archive.html @@ -1,9 +1,6 @@ {% extends "base.html" %} {% block content %} {% for item in items %} - {% ifchanged item.week %} -

{{ item.year }} week {{ item.week }}

- {% endifchanged %} {% include "listitem.html" with item=item %} {% endfor %} {% endblock %}