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 371B

1234567891011121314151617
  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/notice.html', context)