From 9a720248a43148ef4896261ddfe79552c99d8b13 Mon Sep 17 00:00:00 2001 From: Jonka Date: Mon, 12 Nov 2018 17:15:20 +0100 Subject: [PATCH] Zwischenstand des Praktikums: index-Fkt muss noch angepasst werden! --- Django_Project/.idea/dataSources.xml | 22 +++++++++++++++++++ Django_Project/Django_Project/settings.py | 3 +++ Django_Project/posts/models.py | 10 ++++++++- Django_Project/posts/views.py | 8 ++++++- Django_Project/templates/base.html | 22 +++++++++++++++++++ .../templates/posts/allMessages.html | 10 +++++++++ Django_Project/templates/posts/index.html | 9 +++++++- 7 files changed, 81 insertions(+), 3 deletions(-) create mode 100644 Django_Project/.idea/dataSources.xml create mode 100644 Django_Project/templates/posts/allMessages.html diff --git a/Django_Project/.idea/dataSources.xml b/Django_Project/.idea/dataSources.xml new file mode 100644 index 0000000..0a419dd --- /dev/null +++ b/Django_Project/.idea/dataSources.xml @@ -0,0 +1,22 @@ + + + + + sqlite.xerial + true + org.sqlite.JDBC + jdbc:sqlite:C:\JONKA\Uni\7. Semester (Medizintechnik OHM Nürnberg)\Repo_fuer_mEIM_Semester7\Django_Project\db.sqlite3 + + + + + + file://$APPLICATION_CONFIG_DIR$/jdbc-drivers/Xerial SQLiteJDBC/3.25.1/license.txt + + + file://$APPLICATION_CONFIG_DIR$/jdbc-drivers/Xerial SQLiteJDBC/3.25.1/sqlite-jdbc-3.25.1.jar + + + + + \ No newline at end of file diff --git a/Django_Project/Django_Project/settings.py b/Django_Project/Django_Project/settings.py index 7caa889..b3e626a 100644 --- a/Django_Project/Django_Project/settings.py +++ b/Django_Project/Django_Project/settings.py @@ -31,6 +31,9 @@ ALLOWED_HOSTS = [] # Application definition INSTALLED_APPS = [ + + 'posts.apps.PostsConfig', + 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', diff --git a/Django_Project/posts/models.py b/Django_Project/posts/models.py index 71a8362..ad3b8d0 100644 --- a/Django_Project/posts/models.py +++ b/Django_Project/posts/models.py @@ -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() diff --git a/Django_Project/posts/views.py b/Django_Project/posts/views.py index f35b601..3595638 100644 --- a/Django_Project/posts/views.py +++ b/Django_Project/posts/views.py @@ -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') diff --git a/Django_Project/templates/base.html b/Django_Project/templates/base.html index 45d2d91..83d1708 100644 --- a/Django_Project/templates/base.html +++ b/Django_Project/templates/base.html @@ -3,9 +3,31 @@ {% block title %} Pla {% endblock %} + + + + + + + + + {% block content %} zzz {% endblock %} diff --git a/Django_Project/templates/posts/allMessages.html b/Django_Project/templates/posts/allMessages.html new file mode 100644 index 0000000..c5c74c0 --- /dev/null +++ b/Django_Project/templates/posts/allMessages.html @@ -0,0 +1,10 @@ + + + + + Messages + + + + + \ No newline at end of file diff --git a/Django_Project/templates/posts/index.html b/Django_Project/templates/posts/index.html index 91454d5..796ba95 100644 --- a/Django_Project/templates/posts/index.html +++ b/Django_Project/templates/posts/index.html @@ -5,5 +5,12 @@ My_Index {% endblock %} {% block content %} -Content der geerbten HTML-Seite + +
+

Text als Jumbotron :-)

+

Hier kommt noch zusätzlicher text, der den/das Jombotron näher erklärt

+
+ + + {% endblock %} \ No newline at end of file