1234567891011121314 |
- from django.shortcuts import render
- from django.http import HttpResponse
- from .models import Notice
- from django.utils import timezone
-
- # Create your views here.
- def index(request):
- 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)
|