Redirect logout to login page
This commit is contained in:
parent
b2c6051bd3
commit
293c2a0aa7
4 changed files with 9 additions and 4 deletions
|
@ -144,4 +144,5 @@ APP = {
|
||||||
}
|
}
|
||||||
|
|
||||||
CRISPY_TEMPLATE_PACK = 'bootstrap4'
|
CRISPY_TEMPLATE_PACK = 'bootstrap4'
|
||||||
|
LOGOUT_REDIRECT_URL = '/'
|
||||||
|
|
||||||
|
|
|
@ -23,9 +23,9 @@
|
||||||
<a class="dropdown-item" href="{% url 'admin:index' %}">Admin</a>
|
<a class="dropdown-item" href="{% url 'admin:index' %}">Admin</a>
|
||||||
<div role="separator" class="dropdown-divider"></div>
|
<div role="separator" class="dropdown-divider"></div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<a class="dropdown-item" href="{% url 'password_change' %}">Modifier le mot de passe</a>
|
<a class="dropdown-item" href="{% url 'password_change' %}">Change password</a>
|
||||||
<div role="separator" class="dropdown-divider"></div>
|
<div role="separator" class="dropdown-divider"></div>
|
||||||
<a class="dropdown-item" href="{% url 'logout' %}">Déconnexion</a>
|
<a class="dropdown-item" href="{% url 'logout' %}">Logout</a>
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
<a class="nav-link" href="{% url 'login' %}?next={% url 'map' %}">Login</a>
|
<a class="nav-link" href="{% url 'login' %}?next={% url 'map' %}">Login</a>
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
{% extends 'map/base.html' %}
|
{% extends 'map/base.html' %}
|
||||||
{% load crispy_forms_tags %}
|
{% load crispy_forms_tags %}
|
||||||
|
|
||||||
|
{% block h1 %}Login{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
<p>Please authenticate before accessing the map.</p>
|
||||||
<form method="post">
|
<form method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{{ form|crispy }}
|
{{ form|crispy }}
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
from django.shortcuts import render
|
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||||
from django.views.generic import ListView
|
from django.views.generic import ListView
|
||||||
|
|
||||||
from map import models
|
from map import models
|
||||||
|
|
||||||
|
|
||||||
class MapView(ListView):
|
class MapView(LoginRequiredMixin, ListView):
|
||||||
model = models.FriendLocation
|
model = models.FriendLocation
|
||||||
context_object_name = 'locations'
|
context_object_name = 'locations'
|
||||||
template_name = 'map/map.html'
|
template_name = 'map/map.html'
|
||||||
|
|
Loading…
Reference in a new issue