Skip to content

Commit

Permalink
Improved the "Blocked Logins" page's admin integration
Browse files Browse the repository at this point in the history
  • Loading branch information
ataylor32 committed Feb 14, 2024
1 parent a972dae commit 3834873
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion defender/templates/defender/admin/blocks.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
<div class="breadcrumbs">
<a href="{% url "admin:index" %}">Home</a> &rsaquo;
<a href="{% url "admin:app_list" "defender" %}">Defender</a> &rsaquo;
{{ title }}
</div>
{% endblock breadcrumbs %}

{% block content %}
<div id="content-main">

<h1>Blocked Logins</h1>
<p>Here is a list of IP's and usernames that are blocked</p>

<div class="module">
Expand Down
7 changes: 5 additions & 2 deletions defender/views.py
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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({

Check warning on line 18 in defender/views.py

View check run for this annotation

Codecov / codecov/patch

defender/views.py#L17-L18

Added lines #L17 - L18 were not covered by tests
"blocked_ip_list": blocked_ip_list,
"blocked_username_list": blocked_username_list,
}
"title": "Blocked logins",
})
return render(request, "defender/admin/blocks.html", context)


Expand Down

0 comments on commit 3834873

Please sign in to comment.