diff --git a/openwisp_users/templates/admin/action_confirmation.html b/openwisp_users/templates/admin/action_confirmation.html index 507c9defc..e7aed5b0d 100644 --- a/openwisp_users/templates/admin/action_confirmation.html +++ b/openwisp_users/templates/admin/action_confirmation.html @@ -1,45 +1 @@ -{% extends 'admin/base_site.html' %} -{% load i18n l10n admin_urls static %} - -{% block extrahead %} - {{ block.super }} - {{ media }} - -{% endblock %} - -{% block bodyclass %}{{ block.super }} app-{{ opts.app_label }} model-{{ opts.model_name }} delete-confirmation - delete-selected-confirmation{% endblock %} - -{% block breadcrumbs %} - -{% endblock %} - -{% block content %} - {% if action == 'make_inactive' %} -

{% blocktrans %}Are you sure you want to make the selected users inactive?{% endblocktrans %}

- {% else %} -

{% blocktrans %}Are you sure you want to make the selected users active?{% endblocktrans %}

- {% endif %} -

{% trans "Summary" %}

- -
{% csrf_token %} - {% for obj in queryset.all %} - - {% endfor %} -
- - - {% trans 'No, take me back' %} -
-
-{% endblock %} +{% extends 'admin/openwisp_users/action_confirmation.html' %} diff --git a/openwisp_users/templates/admin/login.html b/openwisp_users/templates/admin/login.html index 1cfca43cf..f3da2a091 100644 --- a/openwisp_users/templates/admin/login.html +++ b/openwisp_users/templates/admin/login.html @@ -1,51 +1 @@ -{% extends "admin/login.html" %} -{% load i18n %} -{% block content %} -{% if form.errors and not form.non_field_errors %} -

-{% if form.errors.items|length == 1 %}Please correct the error below{% else %}Please correct the errors below{% endif %} -

-{% endif %} - -{% if form.non_field_errors %} -{% for error in form.non_field_errors %} -

- {{ error }} -

-{% endfor %} -{% endif %} - -
- -{% if user.is_authenticated %} -

-{% block trimmed %} - You are authenticated as {{ username }}, but are not authorized to - access this page. Would you like to login to a different account? -{% endblock %} -

-{% endif %} - -
{% csrf_token %} -
- {{ form.username.errors }} - - {{ form.username }} -
-
- {{ form.password.errors }} - {{ form.password.label_tag }} {{ form.password }} - -
- -
- -
-
- -
-{% endblock %} +{% extends 'admin/openwisp_users/login.html' %} diff --git a/openwisp_users/templates/admin/openwisp_users/action_confirmation.html b/openwisp_users/templates/admin/openwisp_users/action_confirmation.html new file mode 100644 index 000000000..507c9defc --- /dev/null +++ b/openwisp_users/templates/admin/openwisp_users/action_confirmation.html @@ -0,0 +1,45 @@ +{% extends 'admin/base_site.html' %} +{% load i18n l10n admin_urls static %} + +{% block extrahead %} + {{ block.super }} + {{ media }} + +{% endblock %} + +{% block bodyclass %}{{ block.super }} app-{{ opts.app_label }} model-{{ opts.model_name }} delete-confirmation + delete-selected-confirmation{% endblock %} + +{% block breadcrumbs %} + +{% endblock %} + +{% block content %} + {% if action == 'make_inactive' %} +

{% blocktrans %}Are you sure you want to make the selected users inactive?{% endblocktrans %}

+ {% else %} +

{% blocktrans %}Are you sure you want to make the selected users active?{% endblocktrans %}

+ {% endif %} +

{% trans "Summary" %}

+ +
{% csrf_token %} + {% for obj in queryset.all %} + + {% endfor %} +
+ + + {% trans 'No, take me back' %} +
+
+{% endblock %} diff --git a/openwisp_users/templates/admin/openwisp_users/login.html b/openwisp_users/templates/admin/openwisp_users/login.html new file mode 100644 index 000000000..ea421b34e --- /dev/null +++ b/openwisp_users/templates/admin/openwisp_users/login.html @@ -0,0 +1,52 @@ +{# Extends Django's built-in admin login template #} +{% extends "admin/login.html" %} +{% load i18n %} +{% block content %} +{% if form.errors and not form.non_field_errors %} +

+{% if form.errors.items|length == 1 %}Please correct the error below{% else %}Please correct the errors below{% endif %} +

+{% endif %} + +{% if form.non_field_errors %} +{% for error in form.non_field_errors %} +

+ {{ error }} +

+{% endfor %} +{% endif %} + +
+ +{% if user.is_authenticated %} +

+{% block trimmed %} + You are authenticated as {{ username }}, but are not authorized to + access this page. Would you like to login to a different account? +{% endblock %} +

+{% endif %} + +
{% csrf_token %} +
+ {{ form.username.errors }} + + {{ form.username }} +
+
+ {{ form.password.errors }} + {{ form.password.label_tag }} {{ form.password }} + +
+ +
+ +
+
+ +
+{% endblock %} diff --git a/tests/openwisp2/sample_users/templates/admin/action_confirmation.html b/tests/openwisp2/sample_users/templates/admin/action_confirmation.html new file mode 100644 index 000000000..e7aed5b0d --- /dev/null +++ b/tests/openwisp2/sample_users/templates/admin/action_confirmation.html @@ -0,0 +1 @@ +{% extends 'admin/openwisp_users/action_confirmation.html' %} diff --git a/tests/openwisp2/sample_users/templates/admin/login.html b/tests/openwisp2/sample_users/templates/admin/login.html new file mode 100644 index 000000000..f3da2a091 --- /dev/null +++ b/tests/openwisp2/sample_users/templates/admin/login.html @@ -0,0 +1 @@ +{% extends 'admin/openwisp_users/login.html' %} diff --git a/tests/openwisp2/settings.py b/tests/openwisp2/settings.py index a02f2d64f..a9aca0a80 100644 --- a/tests/openwisp2/settings.py +++ b/tests/openwisp2/settings.py @@ -89,14 +89,11 @@ TEMPLATES = [ { "BACKEND": "django.template.backends.django.DjangoTemplates", - "DIRS": [ - os.path.join(os.path.dirname(BASE_DIR), "openwisp_users", "templates") - ], "OPTIONS": { "loaders": [ "django.template.loaders.filesystem.Loader", - "openwisp_utils.loaders.DependencyLoader", "django.template.loaders.app_directories.Loader", + "openwisp_utils.loaders.DependencyLoader", ], "context_processors": [ "django.template.context_processors.debug",