Browse Source

Template + Bootstrap

master
Nadege 4 years ago
parent
commit
b1254fc736
7 changed files with 78 additions and 3 deletions
  1. 1
    0
      news/settings.py
  2. 2
    1
      news/urls.py
  3. 12
    0
      posts/templates/posts/about.html
  4. 15
    0
      posts/templates/posts/index.html
  5. 4
    2
      posts/urls.py
  6. 8
    0
      posts/views.py
  7. 36
    0
      templates/base.html

+ 1
- 0
news/settings.py View File

@@ -37,6 +37,7 @@ INSTALLED_APPS = [
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'posts'
]

MIDDLEWARE = [

+ 2
- 1
news/urls.py View File

@@ -14,7 +14,8 @@ Including another URLconf
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import include, path
from django.urls import path,include
from posts import views

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

+ 12
- 0
posts/templates/posts/about.html View File

@@ -0,0 +1,12 @@
{% extends "base.html" %}
{% block content %}

<h2>Seite Infos</h2>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec rhoncus
massa non tortor. Vestibulum diam diam, posuere in viverra in,
ullamcorper et libero. Donec eget libero quis risus congue imperdiet ac
id lectus. Nam euismod cursus arcu, et consequat libero ullamcorper sit
amet.
</p>
{% endblock %}

+ 15
- 0
posts/templates/posts/index.html View File

@@ -0,0 +1,15 @@
{% extends "base.html" %}
{% block content %}
<div class="container">
<div class="jumbotron">
<h2>Meine Posts !</h2>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec rhoncus
massa non tortor. Vestibulum diam diam, posuere in viverra in,
ullamcorper et libero. Donec eget libero quis risus congue imperdiet ac
id lectus. Nam euismod cursus arcu, et consequat libero ullamcorper sit
amet.
</p>
</div>
</div>
{% endblock %}

+ 4
- 2
posts/urls.py View File

@@ -1,7 +1,9 @@
from django.urls import path

from . import views
from posts import views

urlpatterns = [
path('', views.index, name='index'),
path('welcome', views.welcome_seite),
path('home', views.welcome_seite),
path('about', views.about_seite)
]

+ 8
- 0
posts/views.py View File

@@ -1,5 +1,13 @@
from django.shortcuts import render
from django.http import HttpResponse
from datetime import datetime

# Create your views here.
def index(request):
return HttpResponse("Hello, world. You're at the posts index.")

def welcome_seite(request):
return render(request, 'posts/index.html')

def about_seite(request):
return render(request, 'posts/about.html')

+ 36
- 0
templates/base.html View File

@@ -0,0 +1,36 @@
<!DOCTYPE html>
<html lang="fr">
<head>
{# <link rel="stylesheet" href="/media/css/style.css" />#}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">

<title>{% block title %}First Django Application{% endblock %}</title>
</head>
<body>
<nav>
{% block nav %}
<nav class="navbar navbar-expand-sm bg-dark navbar-dark">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="/posts/home">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://www.google.de/?hl=de">google</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="/posts/about">about</a>
</li>
</ul>
</nav>
{% endblock %}
</nav>
<section id="content">
{% block content %}{% endblock %}
</section>
<footer>&copy; Danke</footer>
</body>
</html>

Loading…
Cancel
Save