added login page

This commit is contained in:
Aubele 2018-06-09 06:00:09 +02:00
parent 36b6ab06e9
commit 4a7d04d43b
4 changed files with 20 additions and 2 deletions

View File

@ -24,6 +24,7 @@ SECRET_KEY = 'e(4!&_nwsvyhml$gbv-v@0eodacfj22sf4gc+0x_&*ym4gl-16'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
LOGIN_REDIRECT_URL = 'roomservice:home'
ALLOWED_HOSTS = []

View File

@ -18,10 +18,17 @@ from django.contrib import admin
from rest_framework.authentication import BasicAuthentication
from rest_framework.documentation import include_docs_urls
from rest_framework.permissions import AllowAny
from django.contrib.auth import views as auth_views
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('roomservice.urls')),
path('login/', auth_views.login, {'template_name': 'login.jinja'}, name='login'),
path('logout/', auth_views.logout, name='logout'),
# APIs
# path('api/', include('respool.api.urls')),

View File

@ -1,4 +1,4 @@
from django.shortcuts import render
from django.shortcuts import render, redirect
from roomservice.models import Room
import logging
logger = logging.getLogger(__name__)
@ -23,4 +23,6 @@ def admin(request):
def favorites(request):
return render(request, 'favorites.jinja', {"title": "rooF(i)S is love rooF(i)S is live!!"})
return render(request, 'favorites.jinja', {"title": "rooF(i)S is love rooF(i)S is live!!"})

View File

@ -0,0 +1,8 @@
{% extends 'base.jinja' %}
{% block content %}
<form method="post">
<input type="hidden" name="csrfmiddlewaretoken" value="{{ csrf_token }}">
{{ form.as_p() }}
<button type="submit">Login</button>
</form>
{% endblock %}