{% extends "admin/base_site.html" %} {% load i18n %} {% block extrastyle %}{{ block.super }} {% endblock %} {% block breadcrumbs %} {% endblock %} {% block content %}

{% trans "Block or unblock any subject — a user, IP, or session. Pick a scope, enter the value, and optionally set a TTL in seconds (leave it blank for a permanent block). Blocks take effect on the subject's next request." %}

{# ── Create / lift a block ────────────────────────────────────────── #}

{% trans 'New block' %}

{% trans 'Restrict a subject from accessing the app' %}
{% csrf_token %} {{ form.non_field_errors }}
{{ form.scope_type }} {{ form.scope_type.errors }}
{{ form.scope_value }} {{ form.scope_value.errors }}

{% trans 'User id, IP address, or session key.' %}

{{ form.ttl }} {{ form.ttl.errors }}

{{ form.ttl.help_text }}

{{ form.reason }} {{ form.reason.errors }}

{% trans 'Recorded with the block for the audit trail.' %}

{% trans 'Advanced overrides' %}
{{ form.status_code }} {{ form.status_code.errors }}

{{ form.status_code.help_text }}

{{ form.message }} {{ form.message.errors }}

{% trans 'Body returned to the blocked subject.' %}

{% trans '“Unblock” lifts an existing block for the same scope and value.' %}
{# ── Active blocks ────────────────────────────────────────────────── #}

{% trans 'Active blocks' %}

{{ active_blocks|length }}
{% if active_blocks %}
{% for entry in active_blocks %} {% endfor %}
{% trans 'Scope' %} {% trans 'Subject' %} {% trans 'Reason' %} {% trans 'Rule' %} {% trans 'Duration' %}
{{ entry.scope.scope_type }} {{ entry.scope.scope_value }} {{ entry.reason|default:'—' }} {% if entry.rule_name %}{{ entry.rule_name }}{% else %}{% endif %} {% if entry.expires_at %} {% trans 'Temporary' %} {% trans 'expires' %} {{ entry.expires_at|date:"M j, Y, g:i a" }} {% else %} {% trans 'Permanent' %} {% if entry.created_at %}{% trans 'since' %} {{ entry.created_at|date:"M j, Y" }}{% endif %} {% endif %}
{% csrf_token %}

{% trans "Only durable (permanent) blocks are listed; temporary (Redis-only) blocks auto-expire and may not appear here on a tiered deployment." %}

{% else %}

{% trans 'No active blocks.' %}

{% trans 'Subjects you block will appear here.' %}

{% endif %}
{% endblock %}