Browse Source

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

master
Jonka Winkle 6 years ago
parent
commit
9a720248a4

+ 22
- 0
Django_Project/.idea/dataSources.xml View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
<data-source source="LOCAL" name="db" uuid="94a4927f-b35a-45fd-a978-43c8801f2dcf">
<driver-ref>sqlite.xerial</driver-ref>
<synchronize>true</synchronize>
<jdbc-driver>org.sqlite.JDBC</jdbc-driver>
<jdbc-url>jdbc:sqlite:C:\JONKA\Uni\7. Semester (Medizintechnik OHM Nürnberg)\Repo_fuer_mEIM_Semester7\Django_Project\db.sqlite3</jdbc-url>
<driver-properties>
<property name="enable_load_extension" value="true" />
</driver-properties>
<libraries>
<library>
<url>file://$APPLICATION_CONFIG_DIR$/jdbc-drivers/Xerial SQLiteJDBC/3.25.1/license.txt</url>
</library>
<library>
<url>file://$APPLICATION_CONFIG_DIR$/jdbc-drivers/Xerial SQLiteJDBC/3.25.1/sqlite-jdbc-3.25.1.jar</url>
</library>
</libraries>
</data-source>
</component>
</project>

+ 3
- 0
Django_Project/Django_Project/settings.py View File

@@ -31,6 +31,9 @@ ALLOWED_HOSTS = []
# Application definition

INSTALLED_APPS = [

'posts.apps.PostsConfig',

'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',

+ 9
- 1
Django_Project/posts/models.py 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
Django_Project/posts/views.py 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')

+ 22
- 0
Django_Project/templates/base.html View File

@@ -3,9 +3,31 @@
<head>
<meta charset="UTF-8">
<title>{% block title %} Pla {% endblock %}</title>

<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
</head>
<body>

<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>

<nav class="navbar navbar-expand-md navbar-fixed-top navbar-dark bg-primary">
<a class="navbar-brand">Navigationsleiste</a>
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="https://www.google.com">Hier geht's zu Google</a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://www.th-nuernberg.de/fakultaeten/efi">Hier geht's zur Efi-Homepage</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Random link to click</a> <!-- href="#" means that link is clickable -->
</li>
</ul>
</nav>

{% block content %} zzz {% endblock %}

</body>

+ 10
- 0
Django_Project/templates/posts/allMessages.html View File

@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Messages</title>
</head>
<body>

</body>
</html>

+ 8
- 1
Django_Project/templates/posts/index.html View File

@@ -5,5 +5,12 @@ My_Index
{% endblock %}

{% block content %}
Content der geerbten HTML-Seite

<div class="jumbotron">
<h1 class="display-4">Text als Jumbotron :-)</h1>
<p class="lead">Hier kommt noch zusätzlicher text, der den/das Jombotron näher erklärt</p>
</div>

<img src="https://www.th-nuernberg.de/fileadmin/global/Bilderpool_KOM/Standorte/Standortbild/171958_8_3_W.jpg">

{% endblock %}

Loading…
Cancel
Save