2019-10-29 14:17:07 +01:00
|
|
|
from django.shortcuts import render
|
|
|
|
from django.http import HttpResponse
|
2019-11-19 12:48:20 +01:00
|
|
|
from .models import Notice
|
|
|
|
from django.utils import timezone
|
2019-10-29 14:17:07 +01:00
|
|
|
|
|
|
|
# Create your views here.
|
|
|
|
def index(request):
|
2019-11-19 12:48:20 +01:00
|
|
|
notices = Notice.objects.all()
|
|
|
|
notices = Notice.objects.filter(pub_start__lte=timezone.now())
|
|
|
|
notices = Notice.objects.filter(pub_end__gte=timezone.now())
|
|
|
|
context = {
|
|
|
|
"notices": notices,
|
|
|
|
}
|
|
|
|
return render(request, 'posts/index.html', context)
|