Lösungen der Aufgaben vom Kurs MEIM1 - Web Engineering von Prof. Hofmann
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 455B

1234567891011121314
  1. from django.shortcuts import render
  2. from django.http import HttpResponse
  3. from .models import Notice
  4. from django.utils import timezone
  5. # Create your views here.
  6. def index(request):
  7. notices = Notice.objects.all()
  8. notices = Notice.objects.filter(pub_start__lte=timezone.now())
  9. notices = Notice.objects.filter(pub_end__gte=timezone.now())
  10. context = {
  11. "notices": notices,
  12. }
  13. return render(request, 'posts/index.html', context)