Skip to content

Commit

Permalink
➖ removed django-hijack-admin
Browse files Browse the repository at this point in the history
  • Loading branch information
bart-maykin committed Feb 14, 2024
1 parent 9ad914a commit 62fda79
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 27 deletions.
7 changes: 3 additions & 4 deletions requirements/base.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@ pydantic
email-validator

# Framework libraries
django ~= 3.2
django==4.2.0
django-admin-index
django-better-admin-arrayfield
django-axes
django-axes[ipware]
django-choices
django-decorator-include
django-hijack ~= 2.3.0
django-hijack-admin
django-hijack
django-redis
django-rosetta
django-sniplates
Expand Down
4 changes: 1 addition & 3 deletions src/sdg/accounts/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from allauth.account.models import EmailAddress
from compat import format_html
from django_otp.plugins.otp_totp.admin import TOTPDeviceAdmin
from hijack_admin.admin import HijackUserAdminMixin

from ..core.events import post_event
from .models import Role, UserInvitation
Expand Down Expand Up @@ -102,7 +101,7 @@ def save(self, commit=True):


@admin.register(User)
class UserAdmin(_UserAdmin, HijackUserAdminMixin):
class UserAdmin(_UserAdmin):
fieldsets = (
(None, {"fields": ("email", "password")}),
(
Expand Down Expand Up @@ -145,7 +144,6 @@ class UserAdmin(_UserAdmin, HijackUserAdminMixin):
"last_name",
"organisaties",
"is_staff",
"hijack_field",
)
ordering = ("email",)
inlines = (RoleInline, UserInvitationInline, EmailaddressInline)
Expand Down
13 changes: 2 additions & 11 deletions src/sdg/conf/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
"sniplates",
"compat", # Part of hijack
"hijack",
"hijack_admin",
"hijack.contrib.admin",
"markdownx",
"markdownify",
"allauth",
Expand Down Expand Up @@ -158,6 +158,7 @@
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
"hijack.middleware.HijackUserMiddleware",
"axes.middleware.AxesMiddleware",
"django_otp.middleware.OTPMiddleware",
"allauth.account.middleware.AccountMiddleware",
Expand Down Expand Up @@ -438,16 +439,6 @@
"REMOTE_ADDR",
)

#
# DJANGO-HIJACK
#
HIJACK_LOGIN_REDIRECT_URL = "/"
HIJACK_LOGOUT_REDIRECT_URL = reverse_lazy("admin:accounts_user_changelist")
HIJACK_REGISTER_ADMIN = False
# This is a CSRF-security risk.
# See: http://django-hijack.readthedocs.io/en/latest/configuration/#allowing-get-method-for-hijack-views
HIJACK_ALLOW_GET_REQUESTS = True

#
# SENTRY - error monitoring
#
Expand Down
3 changes: 1 addition & 2 deletions src/sdg/templates/admin/base_site.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% extends "admin/base.html" %}
{% load i18n static hijack_tags utils %}
{% load i18n static utils %}

{% block title %}
{{ title }} | {{ site_title|default:_('Administratie') }}
Expand Down Expand Up @@ -46,7 +46,6 @@ <h1 id="site-name">
{% endblock %}

{% block messages %}
{% hijack_notification %}
{{ block.super }}
{% endblock %}

Expand Down
4 changes: 1 addition & 3 deletions src/sdg/templates/api/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% load static hijack_tags %}<!DOCTYPE html>
{% load static %}<!DOCTYPE html>
<html lang="en"
class="view {% block view_class %}view--{{ request.resolver_match.namespaces|join:'-' }}-{{ request.resolver_match.url_name }}{% endblock %}">
<head>
Expand All @@ -19,8 +19,6 @@
</head>

<body class="view__body">
{% hijack_notification %}

<div class="title">
<h1 class="title__header">PDC API voor producten in de SDG</h1>
<p class="title__description">Beheer de teksten van producten en diensten t.b.v. de Single Digital Gateway (SDG)</p>
Expand Down
4 changes: 1 addition & 3 deletions src/sdg/templates/master.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% load static hijack_tags solo_tags %}
{% load static solo_tags %}
{% get_solo 'core.SiteConfiguration' as siteconfig %}

<!DOCTYPE html>
Expand Down Expand Up @@ -26,8 +26,6 @@
</head>

<body class="view__body">
{% hijack_notification %}

{% block outer_content %}
{% endblock %}

Expand Down
2 changes: 1 addition & 1 deletion src/sdg/templates/mocks/kvk.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% load static producten i18n markdownify hijack_tags %}
{% load static producten i18n markdownify %}

<!DOCTYPE html>
<html lang="en">
Expand Down

0 comments on commit 62fda79

Please sign in to comment.