From 3834873aad8a8636721af3f39ac9489e392e7877 Mon Sep 17 00:00:00 2001 From: Adam Taylor Date: Wed, 14 Feb 2024 13:39:44 -0700 Subject: [PATCH] Improved the "Blocked Logins" page's admin integration --- defender/templates/defender/admin/blocks.html | 2 +- defender/views.py | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/defender/templates/defender/admin/blocks.html b/defender/templates/defender/admin/blocks.html index 5bda17e..43c846b 100644 --- a/defender/templates/defender/admin/blocks.html +++ b/defender/templates/defender/admin/blocks.html @@ -12,13 +12,13 @@ {% endblock breadcrumbs %} {% block content %}
-

Blocked Logins

Here is a list of IP's and usernames that are blocked

diff --git a/defender/views.py b/defender/views.py index 6d78006..7d31e65 100644 --- a/defender/views.py +++ b/defender/views.py @@ -1,5 +1,6 @@ from django.shortcuts import render from django.http import HttpResponseRedirect +from django.contrib import admin from django.contrib.admin.views.decorators import staff_member_required from django.urls import reverse @@ -13,10 +14,12 @@ def block_view(request): blocked_ip_list = get_blocked_ips() blocked_username_list = get_blocked_usernames() - context = { + context = admin.site.index(request).context_data + context.update({ "blocked_ip_list": blocked_ip_list, "blocked_username_list": blocked_username_list, - } + "title": "Blocked logins", + }) return render(request, "defender/admin/blocks.html", context)