Compare commits

..

No commits in common. "6faa6f502b39377ea8f85a7fca52492f3618c5c5" and "b20760f68820b8f9a65e9aef41834cc71a590a6b" have entirely different histories.

4 changed files with 4 additions and 7 deletions

View file

@ -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 = {}

View file

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

View file

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

View file

@ -15,4 +15,3 @@ redis
django-brake
python-telegram-bot
ox
isoweek