feat: use django-hijack to switch user accounts

Resolves #74
This commit is contained in:
James Graham
2021-02-08 14:40:37 +00:00
parent f4bd9a0cef
commit 9164ea8a05
5 changed files with 29 additions and 1 deletions

View File

@@ -158,6 +158,8 @@ THIRD_PARTY_APPS = [
'rest_framework',
'post_office',
'bootstrap_datepicker_plus',
'hijack',
'compat',
]
FIRST_PARTY_APPS = [
@@ -265,7 +267,7 @@ AUTH_USER_MODEL = 'people.User'
LOGIN_URL = reverse_lazy('login')
LOGIN_REDIRECT_URL = reverse_lazy('index')
LOGIN_REDIRECT_URL = reverse_lazy('people:person.profile')
# Internationalization
# https://docs.djangoproject.com/en/2.2/topics/i18n/
@@ -353,6 +355,13 @@ CONSTANCE_CONFIG_FIELDSETS = {
CONSTANCE_BACKEND = 'constance.backends.database.DatabaseBackend'
# Django Hijack settings
# See https://django-hijack.readthedocs.io/en/stable/
HIJACK_USE_BOOTSTRAP = True
# Bootstrap settings
# See https://django-bootstrap4.readthedocs.io/en/latest/settings.html

View File

@@ -27,6 +27,10 @@
{% load staticfiles %}
<link rel="stylesheet" href="{% static 'css/global.css' %}">
<link rel="stylesheet"
type="text/css"
href="{% static 'hijack/hijack-styles.css' %}" />
{% if 'javascript_in_head'|bootstrap_setting %}
{% if 'include_jquery'|bootstrap_setting %}
{# jQuery JavaScript if it is in head #}
@@ -144,6 +148,9 @@
</div>
{% endif %}
{% load hijack_tags %}
{% hijack_notification %}
{% if request.user.is_authenticated and not request.user.has_person %}
<div class="alert alert-info rounded-0" role="alert">
<p class="text-center mb-0">

View File

@@ -25,6 +25,9 @@ urlpatterns = [
path('select2/',
include('django_select2.urls')),
path('hijack/',
include('hijack.urls', namespace='hijack')),
path('',
include('django.contrib.auth.urls')),