Browse Source

Praktikum Version 4

devel
Lennart Heimbs 4 years ago
parent
commit
059f9e6d11

+ 5
- 3
news/news/settings.py View File

@@ -54,7 +54,9 @@ ROOT_URLCONF = 'news.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'DIRS': [
os.path.join(BASE_DIR, 'templates')
],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
@@ -103,9 +105,9 @@ AUTH_PASSWORD_VALIDATORS = [
# Internationalization
# https://docs.djangoproject.com/en/2.2/topics/i18n/

LANGUAGE_CODE = 'en-us'
LANGUAGE_CODE = 'de-de'

TIME_ZONE = 'UTC'
TIME_ZONE = 'Europe/Berlin'

USE_I18N = True


+ 1
- 0
news/news/urls.py View File

@@ -17,6 +17,7 @@ from django.contrib import admin
from django.urls import path, include

urlpatterns = [
path('', include('posts.urls')),
path('posts/', include('posts.urls')),
path('admin/', admin.site.urls),
]

+ 1
- 1
news/posts/urls.py View File

@@ -2,5 +2,5 @@ from django.urls import path
from . import views

urlpatterns = [
path('', views.index, name='index',)
path('', views.index, name='index')
]

+ 2
- 1
news/posts/views.py View File

@@ -3,4 +3,5 @@ from django.http import HttpResponse

# Create your views here.
def index(request):
return HttpResponse("Posts Index")
return render(request, 'posts/index.html')
#HttpResponse("Posts Index")

+ 15
- 0
news/templates/base.html View File

@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>{% block title %} Placeholder {% endblock %}</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<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.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
</head>
<body>
{% include 'navbar.html' %}
{% block content %} Placeholder {% endblock %}
</body>
</html>

+ 19
- 0
news/templates/navbar.html View File

@@ -0,0 +1,19 @@
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<a class="navbar-brand" href="#">Menu</a>
<div id="navbarNav">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="{% url 'index' %}">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{% url 'index' %}">Posts</a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://www.th-nuernberg.de/fakultaeten/efi/">EFI</a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://www.google.com">Google</a>
</li>
</ul>
</div>
</nav>

+ 12
- 0
news/templates/posts/index.html View File

@@ -0,0 +1,12 @@
{% extends 'base.html' %}

{% block title %}
Index
{% endblock %}

{% block content %}
<div class="jumbotron">
<h1 class="display-4">Index of News App</h1>
<p class="lead">Some placeholder Text</p>
</div>
{% endblock %}

Loading…
Cancel
Save