|
123456789 |
- from django.shortcuts import render
- from .models import Notice
- from django.utils import timezone
- def index(request):
- notices = Notice.objects.all()
- notices = notices.filter(pub_start__lte=timezone.now())
- notices = notices.filter(pub_end__gte=timezone.now())
- context = {'notices': notices}
- return render(request, 'posts/Notice.html', context)
|