added login form
This commit is contained in:
parent
6ef58d975d
commit
3f62283c42
7 changed files with 42 additions and 11 deletions
|
|
@ -3,9 +3,8 @@ from django.shortcuts import render
|
||||||
|
|
||||||
# Create your views here.
|
# Create your views here.
|
||||||
def viewblog(request):
|
def viewblog(request):
|
||||||
return None
|
return render(request, 'blog/index.html')
|
||||||
|
|
||||||
|
|
||||||
def addpost(request):
|
def addpost(request):
|
||||||
context = {'title': 'Neuen Post erstellen'}
|
return render(request, 'blog/addpost.html')
|
||||||
return render(request, 'blog/addpost.html', context)
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@ from pathlib import Path
|
||||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||||
|
|
||||||
|
|
||||||
# Quick-start development settings - unsuitable for production
|
# Quick-start development settings - unsuitable for production
|
||||||
# See https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/
|
# See https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/
|
||||||
|
|
||||||
|
|
@ -27,7 +26,6 @@ DEBUG = True
|
||||||
|
|
||||||
ALLOWED_HOSTS = []
|
ALLOWED_HOSTS = []
|
||||||
|
|
||||||
|
|
||||||
# Application definition
|
# Application definition
|
||||||
|
|
||||||
INSTALLED_APPS = [
|
INSTALLED_APPS = [
|
||||||
|
|
@ -71,7 +69,6 @@ TEMPLATES = [
|
||||||
|
|
||||||
WSGI_APPLICATION = 'markdownblog.wsgi.application'
|
WSGI_APPLICATION = 'markdownblog.wsgi.application'
|
||||||
|
|
||||||
|
|
||||||
# Database
|
# Database
|
||||||
# https://docs.djangoproject.com/en/4.0/ref/settings/#databases
|
# https://docs.djangoproject.com/en/4.0/ref/settings/#databases
|
||||||
|
|
||||||
|
|
@ -88,8 +85,6 @@ DATABASES = {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Password validation
|
# Password validation
|
||||||
# https://docs.djangoproject.com/en/4.0/ref/settings/#auth-password-validators
|
# https://docs.djangoproject.com/en/4.0/ref/settings/#auth-password-validators
|
||||||
|
|
||||||
|
|
@ -108,7 +103,6 @@ AUTH_PASSWORD_VALIDATORS = [
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
# Internationalization
|
# Internationalization
|
||||||
# https://docs.djangoproject.com/en/4.0/topics/i18n/
|
# https://docs.djangoproject.com/en/4.0/topics/i18n/
|
||||||
|
|
||||||
|
|
@ -120,7 +114,6 @@ USE_I18N = True
|
||||||
|
|
||||||
USE_TZ = True
|
USE_TZ = True
|
||||||
|
|
||||||
|
|
||||||
# Static files (CSS, JavaScript, Images)
|
# Static files (CSS, JavaScript, Images)
|
||||||
# https://docs.djangoproject.com/en/4.0/howto/static-files/
|
# https://docs.djangoproject.com/en/4.0/howto/static-files/
|
||||||
|
|
||||||
|
|
@ -130,3 +123,6 @@ STATIC_URL = 'static/'
|
||||||
# https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field
|
# https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field
|
||||||
|
|
||||||
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||||
|
|
||||||
|
LOGIN_REDIRECT_URL = "/"
|
||||||
|
LOGOUT_REDIRECT_URL = "/"
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
<html lang="de">
|
<html lang="de">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>{{ title }}</title>
|
<title>{% block title %}{% endblock %}</title>
|
||||||
<!-- Compiled and minified CSS -->
|
<!-- Compiled and minified CSS -->
|
||||||
<link type="text/css" rel="stylesheet"
|
<link type="text/css" rel="stylesheet"
|
||||||
href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css"
|
href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css"
|
||||||
|
|
@ -27,6 +27,17 @@
|
||||||
</li>
|
</li>
|
||||||
<li><a class="subheader">Subheader</a></li>
|
<li><a class="subheader">Subheader</a></li>
|
||||||
<li><a class="waves-effect" href="#!">Third Link With Waves</a></li>
|
<li><a class="waves-effect" href="#!">Third Link With Waves</a></li>
|
||||||
|
<li>
|
||||||
|
<div class="divider"></div>
|
||||||
|
</li>
|
||||||
|
{% if user.is_authenticated %}
|
||||||
|
<li><a class="waves-effect" href="{% url 'admin:index' %}"><i
|
||||||
|
class="material-icons">admin_panel_settings</i>Admin
|
||||||
|
panel</a></li>
|
||||||
|
<li><a class="waves-effect" href="{% url 'logout' %}"><i class="material-icons">logout</i>Logout</a></li>
|
||||||
|
{% else %}
|
||||||
|
<li><a class="waves-effect" href="{% url 'login' %}"><i class="material-icons">login</i>Login</a></li>
|
||||||
|
{% endif %}
|
||||||
</ul>
|
</ul>
|
||||||
</header>
|
</header>
|
||||||
<main>
|
<main>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,7 @@
|
||||||
{% extends 'base/base.html' %}
|
{% extends 'base/base.html' %}
|
||||||
|
{% block title %}
|
||||||
|
Neuer Post
|
||||||
|
{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h1>Neuen Post erstellen</h1>
|
<h1>Neuen Post erstellen</h1>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
7
markdownblog/markdownblog/templates/blog/index.html
Normal file
7
markdownblog/markdownblog/templates/blog/index.html
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
{% extends 'base/base.html' %}
|
||||||
|
{% block title %}
|
||||||
|
Willkommen!
|
||||||
|
{% endblock %}
|
||||||
|
{% block content %}
|
||||||
|
<h1>Willkommen!</h1>
|
||||||
|
{% endblock %}
|
||||||
14
markdownblog/markdownblog/templates/registration/login.html
Normal file
14
markdownblog/markdownblog/templates/registration/login.html
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
{% extends 'base/base.html' %}
|
||||||
|
{% block title %}
|
||||||
|
Log-in
|
||||||
|
{% endblock %}
|
||||||
|
{% block content %}
|
||||||
|
<div class="col s8 offset-s2">
|
||||||
|
<form method="post">
|
||||||
|
{% csrf_token %}
|
||||||
|
{{ form.as_p }}
|
||||||
|
<button type="submit" class="waves-effect waves-light btn">Log In<i class="material-icons right">send</i>
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
|
@ -5,4 +5,5 @@ from django.urls import path, include
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('', include('blog.urls')),
|
path('', include('blog.urls')),
|
||||||
path('admin/', admin.site.urls),
|
path('admin/', admin.site.urls),
|
||||||
|
path('auth/', include('django.contrib.auth.urls'))
|
||||||
]
|
]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue