You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

views.py 369B

5 years ago
5 years ago
12345678910111213
  1. from django.shortcuts import render
  2. from .models import Notice
  3. from django.utils import timezone
  4. def index (request):
  5. notices = Notice.objects.all()
  6. notices = notices.filter(pub_start__lte=timezone.now())
  7. notices = notices.filter(pub_end__gte=timezone.now())
  8. context = { "notices" : notices }
  9. return render(request, 'posts/index.html', context)