diff --git a/app/item/views.py b/app/item/views.py index 8452429..a65ccf7 100644 --- a/app/item/views.py +++ b/app/item/views.py @@ -2,7 +2,6 @@ import json import xml.etree.ElementTree as ET import ox -import isoweek from django.utils import timezone from django.utils.timezone import datetime, timedelta @@ -50,7 +49,7 @@ def get_byline(week): def get_weeks(archive): weeks = sorted(set(archive.values_list('year', 'week'))) - weeks = [isoweek.Week(*w).monday().strftime('%Y-%m-%d') for w in weeks] + weeks = [datetime.strptime('%s-W%s-1' % w, "%Y-W%U-%w").strftime('%Y-%m-%d') for w in weeks] weeks = [{ 'date': week, 'year': week.split('-')[0], @@ -90,7 +89,7 @@ def archive(request, year=None, month=None, day=None, week=None): archive = models.Item.all_public() if year and month and day: date = datetime.strptime('%s-%s-%s' % (year, month, day), '%Y-%m-%d') - week = date.isocalendar()[1] + week = int(date.strftime('%U')) year = int(year) archive_week = archive.filter(year=year, week=week).order_by('published') years = {} diff --git a/app/listmonk/utils.py b/app/listmonk/utils.py index 657c04d..001fa5a 100644 --- a/app/listmonk/utils.py +++ b/app/listmonk/utils.py @@ -23,8 +23,7 @@ def get_auth(headers): def send_week(monday): from . import views - date = datetime.strptime(date, '%Y-%m-%d') - monday = views.get_monday(date) + monday = views.get_monday(monday) year, month, day = monday.split('-') body = views.week(year, month, day) name = 'weekly-digest-%s' % monday diff --git a/app/listmonk/views.py b/app/listmonk/views.py index de71841..2aa4c80 100644 --- a/app/listmonk/views.py +++ b/app/listmonk/views.py @@ -34,7 +34,7 @@ def week(year, month, day): week=ExtractWeek('published') ) date = datetime.strptime('%s-%s-%s' % (year, month, day), '%Y-%m-%d') - week = date.isocalendar()[1] + week = int(date.strftime('%U')) year = int(year) archive_week = archive.filter(year=year, week=week).order_by('published') context['weeks'] = get_weeks(archive) diff --git a/requirements.txt b/requirements.txt index ce76fb5..e80dfb9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -15,4 +15,3 @@ redis django-brake python-telegram-bot ox -isoweek