{% extends "admin/base.html" %} {% from "admin/macros/forms.html" import field, checkbox, csrf %} {% from "admin/macros/history.html" import entry_item %} {% block title %}{{ "Edit user" if target else "New user" }}{% endblock %} {% set values = form or {} %} {% block content %} {% if errors %}
{% endif %}
{{ csrf(csrf_token) }}
{% if not target %} {{ field("username", "Username", values.get("username", ""), required=True) }} {% endif %} {{ field("email", "Email", values.get("email", target.email if target else ""), type="email") }} {{ field("full_name", "Full name", values.get("full_name", target.full_name if target else "")) }}
{{ field("password", "Password" if not target else "New password", "", type="password", required=(not target), help_text="" if not target else "Leave empty to keep the current password.") }}
{{ field("confirm_password", "Confirm password", "", type="password", required=(not target)) }}

Roles

{% set selected = selected_role_ids or [] %}
{% for role in roles %}
{% else %}
No roles defined yet.
{% endfor %}

Status

{% set active_value = values.get("is_active", target.is_active if target else True) %} {{ checkbox("is_active", "Active", active_value) }} {% if user.is_superuser %} {% set superuser_value = values.get("is_superuser", target.is_superuser if target else False) %} {{ checkbox("is_superuser", "Superuser", superuser_value) }} {% endif %}
{% if history %}

History {{ history.count }}

{% if not history.entries %}
No changes recorded yet.
{% endif %} {% for entry in history.entries %} {{ entry_item(entry) }} {% endfor %}
{% endif %}
Cancel
{% endblock %}