Show newsletters that are published
This commit is contained in:
parent
243043eb5a
commit
65aa2c4ee8
@ -1,12 +1,14 @@
|
|||||||
import json
|
import json
|
||||||
|
|
||||||
|
from django.db.models import Q
|
||||||
from django.shortcuts import render, HttpResponse
|
from django.shortcuts import render, HttpResponse
|
||||||
|
from django.utils import timezone
|
||||||
|
|
||||||
from .models import Newsletter, Subscriber
|
from .models import Newsletter, Subscriber
|
||||||
|
|
||||||
|
|
||||||
def newsletters(request):
|
def newsletters(request):
|
||||||
newsletters = Newsletter.objects.filter(sent=True).order_by('-publish')
|
newsletters = Newsletter.objects.filter(Q(publish__lte=timezone.now())).order_by('-publish')
|
||||||
return render(request, 'newsletters.html', {'newsletters': newsletters})
|
return render(request, 'newsletters.html', {'newsletters': newsletters})
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user