-
-
Notifications
You must be signed in to change notification settings - Fork 91
[fix] OpenWisp DependencyLoader should be after django template loaders #490
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,45 +1 @@ | ||
| {% extends 'admin/base_site.html' %} | ||
| {% load i18n l10n admin_urls static %} | ||
|
|
||
| {% block extrahead %} | ||
| {{ block.super }} | ||
| {{ media }} | ||
| <script src='{% static 'admin/js/cancel.js' %}'></script> | ||
| {% endblock %} | ||
|
|
||
| {% block bodyclass %}{{ block.super }} app-{{ opts.app_label }} model-{{ opts.model_name }} delete-confirmation | ||
| delete-selected-confirmation{% endblock %} | ||
|
|
||
| {% block breadcrumbs %} | ||
| <div class='breadcrumbs'> | ||
| <a href='{% url 'admin:index' %}'>{% trans 'Home' %}</a> | ||
| › <a href='{% url 'admin:app_list' app_label=opts.app_label %}'>{{ opts.app_config.verbose_name }}</a> | ||
| › <a href='{% url opts|admin_urlname:'changelist' %}'>{{ opts.verbose_name_plural|capfirst }}</a> | ||
| › {% trans 'Modify active status' %} | ||
| </div> | ||
| {% endblock %} | ||
|
|
||
| {% block content %} | ||
| {% if action == 'make_inactive' %} | ||
| <p>{% blocktrans %}Are you sure you want to make the selected users inactive?{% endblocktrans %}</p> | ||
| {% else %} | ||
| <p>{% blocktrans %}Are you sure you want to make the selected users active?{% endblocktrans %}</p> | ||
| {% endif %} | ||
| <h2>{% trans "Summary" %}</h2> | ||
| <ul> | ||
| {% for user in queryset.all %} | ||
| <li>{% trans "User" %}: {{ user }}</li> | ||
| {% endfor %} | ||
| </ul> | ||
| <form action='' method='post'>{% csrf_token %} | ||
| {% for obj in queryset.all %} | ||
| <input type='hidden' name='_selected_action' value='{{ obj.pk|unlocalize }}'/> | ||
| {% endfor %} | ||
| <div class='submit-row'> | ||
| <input type='hidden' name='action' value='{{ action }}'/> | ||
| <input type='submit' name='confirmation' value='{% trans "Confirm" %}'/> | ||
| <a href='#' onclick='window.history.back(); return false;' | ||
| class='button cancel-link'>{% trans 'No, take me back' %}</a> | ||
| </div> | ||
| </form> | ||
| {% endblock %} | ||
| {% extends 'admin/openwisp_users/action_confirmation.html' %} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,51 +1 @@ | ||
| {% extends "admin/login.html" %} | ||
| {% load i18n %} | ||
| {% block content %} | ||
| {% if form.errors and not form.non_field_errors %} | ||
| <p class="errornote"> | ||
| {% if form.errors.items|length == 1 %}Please correct the error below{% else %}Please correct the errors below{% endif %} | ||
| </p> | ||
| {% endif %} | ||
|
|
||
| {% if form.non_field_errors %} | ||
| {% for error in form.non_field_errors %} | ||
| <p class="errornote"> | ||
| {{ error }} | ||
| </p> | ||
| {% endfor %} | ||
| {% endif %} | ||
|
|
||
| <div id="content-main"> | ||
|
|
||
| {% if user.is_authenticated %} | ||
| <p class="errornote"> | ||
| {% 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 %} | ||
| </p> | ||
| {% endif %} | ||
|
|
||
| <form action="{{ app_path }}" method="post" id="login-form">{% csrf_token %} | ||
| <div class="form-row"> | ||
| {{ form.username.errors }} | ||
| <label class="required" for="id_username"> | ||
| {% trans 'Email, phone number or username' %}: | ||
| </label> | ||
| {{ form.username }} | ||
| </div> | ||
| <div class="form-row"> | ||
| {{ form.password.errors }} | ||
| {{ form.password.label_tag }} {{ form.password }} | ||
| <input type="hidden" name="next" value="{{ next }}" /> | ||
| </div> | ||
| <div class="form-row"> | ||
| <a href="{% url 'account_reset_password' %}">Forgot Password?</a> | ||
| </div> | ||
| <div class="submit-row"> | ||
| <input type="submit" value="Log in" /> | ||
| </div> | ||
| </form> | ||
|
|
||
| </div> | ||
| {% endblock %} | ||
| {% extends 'admin/openwisp_users/login.html' %} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| {% extends 'admin/base_site.html' %} | ||
| {% load i18n l10n admin_urls static %} | ||
|
|
||
| {% block extrahead %} | ||
| {{ block.super }} | ||
| {{ media }} | ||
| <script src='{% static 'admin/js/cancel.js' %}'></script> | ||
| {% endblock %} | ||
|
|
||
| {% block bodyclass %}{{ block.super }} app-{{ opts.app_label }} model-{{ opts.model_name }} delete-confirmation | ||
| delete-selected-confirmation{% endblock %} | ||
|
|
||
| {% block breadcrumbs %} | ||
| <div class='breadcrumbs'> | ||
| <a href='{% url 'admin:index' %}'>{% trans 'Home' %}</a> | ||
| › <a href='{% url 'admin:app_list' app_label=opts.app_label %}'>{{ opts.app_config.verbose_name }}</a> | ||
| › <a href='{% url opts|admin_urlname:'changelist' %}'>{{ opts.verbose_name_plural|capfirst }}</a> | ||
| › {% trans 'Modify active status' %} | ||
| </div> | ||
| {% endblock %} | ||
|
|
||
| {% block content %} | ||
| {% if action == 'make_inactive' %} | ||
| <p>{% blocktrans %}Are you sure you want to make the selected users inactive?{% endblocktrans %}</p> | ||
| {% else %} | ||
| <p>{% blocktrans %}Are you sure you want to make the selected users active?{% endblocktrans %}</p> | ||
| {% endif %} | ||
| <h2>{% trans "Summary" %}</h2> | ||
| <ul> | ||
| {% for user in queryset.all %} | ||
| <li>{% trans "User" %}: {{ user }}</li> | ||
| {% endfor %} | ||
| </ul> | ||
| <form action='' method='post'>{% csrf_token %} | ||
| {% for obj in queryset.all %} | ||
| <input type='hidden' name='_selected_action' value='{{ obj.pk|unlocalize }}'/> | ||
| {% endfor %} | ||
|
Comment on lines
+30
to
+37
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Consider caching the queryset to avoid duplicate database queries.
♻️ Proposed fix using {% with %} to cache the queryset+{% with users=queryset.all %}
<ul>
- {% for user in queryset.all %}
+ {% for user in users %}
<li>{% trans "User" %}: {{ user }}</li>
{% endfor %}
</ul>
<form action='' method='post'>{% csrf_token %}
- {% for obj in queryset.all %}
+ {% for obj in users %}
<input type='hidden' name='_selected_action' value='{{ obj.pk|unlocalize }}'/>
{% endfor %}
+{% endwith %}🤖 Prompt for AI Agents |
||
| <div class='submit-row'> | ||
| <input type='hidden' name='action' value='{{ action }}'/> | ||
| <input type='submit' name='confirmation' value='{% trans "Confirm" %}'/> | ||
| <a href='#' onclick='window.history.back(); return false;' | ||
| class='button cancel-link'>{% trans 'No, take me back' %}</a> | ||
| </div> | ||
| </form> | ||
| {% endblock %} | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -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 %} | ||||||||||||||||||
| <p class="errornote"> | ||||||||||||||||||
| {% if form.errors.items|length == 1 %}Please correct the error below{% else %}Please correct the errors below{% endif %} | ||||||||||||||||||
| </p> | ||||||||||||||||||
| {% endif %} | ||||||||||||||||||
|
Comment on lines
+5
to
+9
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: find . -path "*/openwisp_users/templates/admin/openwisp_users/login.html" -type fRepository: openwisp/openwisp-users Length of output: 125 🏁 Script executed: wc -l openwisp_users/templates/admin/openwisp_users/login.html 2>/dev/null || echo "File not found in standard location"Repository: openwisp/openwisp-users Length of output: 126 🏁 Script executed: cat -n openwisp_users/templates/admin/openwisp_users/login.html 2>/dev/null || fd "login.html" | grep openwisp_users | head -5Repository: openwisp/openwisp-users Length of output: 1788 🌐 Web query:
💡 Result: Django
|
||||||||||||||||||
|
|
||||||||||||||||||
| {% if form.non_field_errors %} | ||||||||||||||||||
| {% for error in form.non_field_errors %} | ||||||||||||||||||
| <p class="errornote"> | ||||||||||||||||||
| {{ error }} | ||||||||||||||||||
| </p> | ||||||||||||||||||
| {% endfor %} | ||||||||||||||||||
| {% endif %} | ||||||||||||||||||
|
|
||||||||||||||||||
| <div id="content-main"> | ||||||||||||||||||
|
|
||||||||||||||||||
| {% if user.is_authenticated %} | ||||||||||||||||||
| <p class="errornote"> | ||||||||||||||||||
| {% 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 %} | ||||||||||||||||||
|
Comment on lines
+23
to
+26
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Incorrect use of The 🐛 Proposed fix {% if user.is_authenticated %}
<p class="errornote">
-{% block trimmed %}
+{% blocktrans trimmed %}
You are authenticated as {{ username }}, but are not authorized to
access this page. Would you like to login to a different account?
-{% endblock %}
+{% endblocktrans %}
</p>
{% endif %}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||
| </p> | ||||||||||||||||||
| {% endif %} | ||||||||||||||||||
|
|
||||||||||||||||||
| <form action="{{ app_path }}" method="post" id="login-form">{% csrf_token %} | ||||||||||||||||||
| <div class="form-row"> | ||||||||||||||||||
| {{ form.username.errors }} | ||||||||||||||||||
| <label class="required" for="id_username"> | ||||||||||||||||||
| {% trans 'Email, phone number or username' %}: | ||||||||||||||||||
| </label> | ||||||||||||||||||
| {{ form.username }} | ||||||||||||||||||
| </div> | ||||||||||||||||||
| <div class="form-row"> | ||||||||||||||||||
| {{ form.password.errors }} | ||||||||||||||||||
| {{ form.password.label_tag }} {{ form.password }} | ||||||||||||||||||
| <input type="hidden" name="next" value="{{ next }}" /> | ||||||||||||||||||
| </div> | ||||||||||||||||||
| <div class="form-row"> | ||||||||||||||||||
| <a href="{% url 'account_reset_password' %}">Forgot Password?</a> | ||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing translation wrapper for "Forgot Password?" link text. For i18n consistency with the rest of the template, this string should be wrapped in 🌐 Proposed fix- <a href="{% url 'account_reset_password' %}">Forgot Password?</a>
+ <a href="{% url 'account_reset_password' %}">{% trans "Forgot Password?" %}</a>🤖 Prompt for AI Agents |
||||||||||||||||||
| </div> | ||||||||||||||||||
| <div class="submit-row"> | ||||||||||||||||||
| <input type="submit" value="Log in" /> | ||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing translation wrapper for "Log in" button value. For i18n consistency, the submit button text should be translatable. 🌐 Proposed fix- <input type="submit" value="Log in" />
+ <input type="submit" value="{% trans 'Log in' %}" />📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||
| </div> | ||||||||||||||||||
| </form> | ||||||||||||||||||
|
|
||||||||||||||||||
| </div> | ||||||||||||||||||
| {% endblock %} | ||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| {% extends 'admin/openwisp_users/action_confirmation.html' %} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| {% extends 'admin/openwisp_users/login.html' %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick | 🔵 Trivial
Body classes reference "delete" actions but template handles activate/deactivate.
The CSS classes
delete-confirmationanddelete-selected-confirmationmay be intentionally reused for consistent admin styling, but they're semantically misleading for activation status changes. Consider whether custom classes would be more appropriate for clarity.🤖 Prompt for AI Agents