Zwischenstand des Praktikums: index-Fkt muss noch angepasst werden!

This commit is contained in:
2018-11-12 17:15:20 +01:00
parent debf9376fc
commit 9a720248a4
7 changed files with 81 additions and 3 deletions
+9 -1
View File
@@ -1,3 +1,11 @@
from django.db import models
# Create your models here.
class Notice(models.Model):
#def __init__(self):
#self.id = super().id
notice_title = models.CharField(max_length = 80)
notice_text = models.CharField(max_length = 400)
pub_start = models.DateTimeField()
pub_end = models.DateTimeField()
+7 -1
View File
@@ -4,4 +4,10 @@ from django.http import HttpResponse
# Create your views here.
def index(request):
return render(request, 'posts/index.html')
#return render(request, 'posts/index.html')
#context = # hier muss Datenbank ausgelesen werden:
# for curr_msg in Notice.objects.all():
# if (curr_msg.pub_start > datetime.now() and curr_msg.pub_end < date......
# context +=
return render(request, 'posts/allMessages.html')