@@ -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), | |||
] |
@@ -1,4 +1,6 @@ | |||
from django.conf.urls import url | |||
from django.conf.urls import url, include, re_path | |||
from . import views | |||
@@ -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) |
@@ -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 %} | |||
@@ -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 %} |