Browse Source

prakt7

master
Janko Hartwig 6 years ago
parent
commit
5e5e30306c

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

@@ -18,5 +18,6 @@ from django.contrib import admin

urlpatterns = [
url(r'^polls/', include('polls.urls')),
url('accounts/', include('django.contrib.auth.urls')),
url(r'^admin/', admin.site.urls),
]

+ 3
- 1
djp/polls/urls.py View File

@@ -1,4 +1,6 @@
from django.conf.urls import url
from django.conf.urls import url, include, re_path



from . import views


+ 2
- 0
djp/polls/views.py View File

@@ -1,6 +1,7 @@
from django.http import HttpResponse
from django.shortcuts import render, redirect
import time
from django.contrib.auth.decorators import login_required
from polls.forms import NoticeForm
from django.utils import timezone
from datetime import timedelta
@@ -15,6 +16,7 @@ def index(request):
# print(n.notice_title)
return render(request, 'polls/index.html', context)

@login_required
def new(request):
if request.method == "POST":
form = NoticeForm(request.POST)

+ 1
- 0
djp/templates/polls/index.html View File

@@ -19,6 +19,7 @@ Index

<p><a href="{% url 'new' %}" class="btn btn-info" role="button">Neue Nachricht</a></p>

<p><a href="{% url 'logout' %}" class="btn btn-warning">Abmelden</a></p>
{% endblock %}



+ 21
- 0
djp/templates/registration/login.html View File

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

{% block title %}
Login
{% endblock %}

{% block content %}

<div class="container">

<form method="post" action="{% url 'login' %}">
{% csrf_token %}
Benutzername: {{ form.username }} <br>
Passwort: {{ form.password }} <br>
<button type="submit" class="btn btn-default">Anmelden</button>
<input type="hidden" name="next" value="{{ next }}" />
</form>

</div>

{% endblock %}

Loading…
Cancel
Save