Solutions for MEIM
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.

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
1234567891011121314151617181920
  1. from django.shortcuts import render
  2. from datetime import timedelta
  3. from django.utils import timezone
  4. from posts.models import Notice
  5. # Create your views here.
  6. #Titel und die Texte aller Meldungen, deren Veröffentlichungsdatum vor und der Endedatum nach dem aktuellen Datum liegt.
  7. def home(request, value=""):
  8. now = timezone.now()
  9. notices = Notice.objects.all()
  10. display_notices = list()
  11. for notice in notices:
  12. if notice.pub_start < now and notice.pub_end > now:
  13. display_notices.append(notice)
  14. context = {
  15. "title": "Beboop",
  16. "notices": display_notices
  17. }
  18. return render(request, 'index.html', context)