Browse Source

Praktikum Version 4

devel
Lennart Heimbs 4 years ago
parent
commit
059f9e6d11

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

TEMPLATES = [ TEMPLATES = [
{ {
'BACKEND': 'django.template.backends.django.DjangoTemplates', 'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'DIRS': [
os.path.join(BASE_DIR, 'templates')
],
'APP_DIRS': True, 'APP_DIRS': True,
'OPTIONS': { 'OPTIONS': {
'context_processors': [ 'context_processors': [
# Internationalization # Internationalization
# https://docs.djangoproject.com/en/2.2/topics/i18n/ # 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 USE_I18N = True



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

from django.urls import path, include from django.urls import path, include


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

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

from . import views from . import views


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

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



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

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

<!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

<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

{% 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