Add authentication app
This commit is contained in:
parent
f4516604bf
commit
e96c272572
5 changed files with 38 additions and 0 deletions
0
authentication/__init__.py
Normal file
0
authentication/__init__.py
Normal file
5
authentication/apps.py
Normal file
5
authentication/apps.py
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
class AuthenticationConfig(AppConfig):
|
||||||
|
name = 'authentication'
|
0
authentication/migrations/__init__.py
Normal file
0
authentication/migrations/__init__.py
Normal file
18
authentication/templates/authentication/login.html
Normal file
18
authentication/templates/authentication/login.html
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
{% extends 'base.html' %}
|
||||||
|
{% load staticfiles %}
|
||||||
|
{% load crispy_forms_filters %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<h1>{% block title %}Login{% endblock %}</h1>
|
||||||
|
|
||||||
|
<div id="login">
|
||||||
|
<form name="LoginForm" action="{% url 'auth_login' %}" method="post">
|
||||||
|
{% if next %}
|
||||||
|
<input type="hidden" name="next" value="{{ next }}"/>
|
||||||
|
{% endif %}
|
||||||
|
{% csrf_token %}
|
||||||
|
{{ form|crispy }}
|
||||||
|
<button type="submit" class="btn btn-primary">Login</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
15
authentication/urls.py
Normal file
15
authentication/urls.py
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
from django.conf.urls import url
|
||||||
|
from django.contrib.auth.views import login, logout
|
||||||
|
|
||||||
|
urlpatterns = [
|
||||||
|
url(r'^login/$',
|
||||||
|
login,
|
||||||
|
{'template_name': 'authentication/login.html'},
|
||||||
|
name='auth_login'
|
||||||
|
),
|
||||||
|
url(r'^logout/$',
|
||||||
|
logout,
|
||||||
|
{'next_page': 'blog_home'},
|
||||||
|
name='auth_logout'
|
||||||
|
),
|
||||||
|
]
|
Loading…
Reference in a new issue