email backend
This commit is contained in:
parent
3faf2c2493
commit
e82d5d5f15
11 changed files with 167 additions and 0 deletions
23
app/listmonk/views.py
Normal file
23
app/listmonk/views.py
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
from django.shortcuts import render
|
||||
from django.template.loader import render_to_string
|
||||
from django.utils.timezone import datetime, timedelta
|
||||
|
||||
from ..item import models
|
||||
from ..item.views import get_weeks
|
||||
|
||||
|
||||
def week(year, month, day):
|
||||
context = {}
|
||||
_, archive = models.Item.public()
|
||||
date = datetime.strptime('%s-%s-%s' % (year, month, day), '%Y-%m-%d')
|
||||
week = int(date.strftime('%W'))
|
||||
year = int(year)
|
||||
archive_week = archive.filter(year=year, week=week).order_by('published')
|
||||
context['weeks'] = get_weeks(archive)
|
||||
context['this_week'] = date.strftime('%Y-%m-%d')
|
||||
context['this_year'] = date.strftime('%Y')
|
||||
extra = models.Week.objects.filter(monday=context['this_week']).first()
|
||||
if extra:
|
||||
context['week_title'] = extra.title
|
||||
context['items'] = archive_week
|
||||
return render_to_string("weekly_email.html", context)
|
||||
Loading…
Add table
Add a link
Reference in a new issue