123456789101112 |
- from django.shortcuts import render
- from .models import Notice
- from django.utils import timezone
-
- # Create your views here.
-
- 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/index.html', context)
|