Skip to content

Format the templates using djade #2120

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

Merged
merged 1 commit into from
Apr 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ repos:
hooks:
- id: django-upgrade
args: [--target-version, "4.2"]
- repo: https://github.com/adamchainz/djade-pre-commit
rev: "1.3.2"
hooks:
- id: djade
args: [--target-version, "4.2"]
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
Expand Down
12 changes: 6 additions & 6 deletions debug_toolbar/templates/debug_toolbar/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
{% block css %}
<link{% if toolbar.csp_nonce %} nonce="{{ toolbar.csp_nonce }}"{% endif %} rel="stylesheet" href="{% static 'debug_toolbar/css/print.css' %}" media="print">
<link{% if toolbar.csp_nonce %} nonce="{{ toolbar.csp_nonce }}"{% endif %} rel="stylesheet" href="{% static 'debug_toolbar/css/toolbar.css' %}">
{% endblock %}
{% endblock css %}
{% block js %}
<script{% if toolbar.csp_nonce %} nonce="{{ toolbar.csp_nonce }}"{% endif %} type="module" src="{% static 'debug_toolbar/js/toolbar.js' %}" async></script>
{% endblock %}
{% endblock js %}
<div id="djDebug" class="djdt-hidden" dir="ltr"
{% if not toolbar.should_render_panels %}
data-store-id="{{ toolbar.store_id }}"
Expand All @@ -19,10 +19,10 @@
{{ toolbar.config.ROOT_TAG_EXTRA_ATTRS|safe }} data-update-on-fetch="{{ toolbar.config.UPDATE_ON_FETCH }}">
<div class="djdt-hidden" id="djDebugToolbar">
<ul id="djDebugPanelList">
<li><a id="djHideToolBarButton" href="#" title="{% trans 'Hide toolbar' %}">{% trans "Hide" %} »</a></li>
<li><a id="djHideToolBarButton" href="#" title="{% translate 'Hide toolbar' %}">{% translate "Hide" %} »</a></li>
<li>
<a id="djToggleThemeButton" href="#" title="{% trans 'Toggle Theme' %}">
{% trans "Toggle Theme" %} {% include "debug_toolbar/includes/theme_selector.html" %}
<a id="djToggleThemeButton" href="#" title="{% translate 'Toggle Theme' %}">
{% translate "Toggle Theme" %} {% include "debug_toolbar/includes/theme_selector.html" %}
</a>
</li>
{% for panel in toolbar.panels %}
Expand All @@ -31,7 +31,7 @@
</ul>
</div>
<div class="djdt-hidden" id="djDebugToolbarHandle">
<div title="{% trans 'Show toolbar' %}" id="djShowToolBarButton">
<div title="{% translate 'Show toolbar' %}" id="djShowToolBarButton">
<span id="djShowToolBarD">D</span><span id="djShowToolBarJ">J</span>DT
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{% load i18n %}

<li id="djdt-{{ panel.panel_id }}" class="djDebugPanelButton">
<input type="checkbox" data-cookie="djdt{{ panel.panel_id }}" {% if panel.enabled %}checked title="{% trans "Disable for next and successive requests" %}"{% else %}title="{% trans "Enable for next and successive requests" %}"{% endif %}>
<input type="checkbox" data-cookie="djdt{{ panel.panel_id }}" {% if panel.enabled %}checked title="{% translate "Disable for next and successive requests" %}"{% else %}title="{% translate "Enable for next and successive requests" %}"{% endif %}>
{% if panel.has_content and panel.enabled %}
<a href="#" title="{{ panel.title }}" class="{{ panel.panel_id }}">
{% else %}
<div class="djdt-contentless{% if not panel.enabled %} djdt-disabled{% endif %}">
{% endif %}
{{ panel.nav_title }}
{% if panel.enabled %}
{% with panel.nav_subtitle as subtitle %}
{% with subtitle=panel.nav_subtitle %}
{% if subtitle %}<br><small>{{ subtitle }}</small>{% endif %}
{% endwith %}
{% endif %}
Expand Down
4 changes: 2 additions & 2 deletions debug_toolbar/templates/debug_toolbar/panels/alerts.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{% load i18n %}

{% if alerts %}
<h4>{% trans "Alerts found" %}</h4>
<h4>{% translate "Alerts found" %}</h4>
{% for alert in alerts %}
<ul>
<li>{{ alert.alert }}</li>
</ul>
{% endfor %}
{% else %}
<h4>{% trans "No alerts found" %}</h4>
<h4>{% translate "No alerts found" %}</h4>
{% endif %}
24 changes: 12 additions & 12 deletions debug_toolbar/templates/debug_toolbar/panels/cache.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{% load i18n %}
<h4>{% trans "Summary" %}</h4>
<h4>{% translate "Summary" %}</h4>
<table>
<thead>
<tr>
<th>{% trans "Total calls" %}</th>
<th>{% trans "Total time" %}</th>
<th>{% trans "Cache hits" %}</th>
<th>{% trans "Cache misses" %}</th>
<th>{% translate "Total calls" %}</th>
<th>{% translate "Total time" %}</th>
<th>{% translate "Cache hits" %}</th>
<th>{% translate "Cache misses" %}</th>
</tr>
</thead>
<tbody>
Expand All @@ -18,7 +18,7 @@ <h4>{% trans "Summary" %}</h4>
</tr>
</tbody>
</table>
<h4>{% trans "Commands" %}</h4>
<h4>{% translate "Commands" %}</h4>
<table>
<thead>
<tr>
Expand All @@ -36,15 +36,15 @@ <h4>{% trans "Commands" %}</h4>
</tbody>
</table>
{% if calls %}
<h4>{% trans "Calls" %}</h4>
<h4>{% translate "Calls" %}</h4>
<table>
<thead>
<tr>
<th colspan="2">{% trans "Time (ms)" %}</th>
<th>{% trans "Type" %}</th>
<th>{% trans "Arguments" %}</th>
<th>{% trans "Keyword arguments" %}</th>
<th>{% trans "Backend" %}</th>
<th colspan="2">{% translate "Time (ms)" %}</th>
<th>{% translate "Type" %}</th>
<th>{% translate "Arguments" %}</th>
<th>{% translate "Keyword arguments" %}</th>
<th>{% translate "Backend" %}</th>
</tr>
</thead>
<tbody>
Expand Down
20 changes: 10 additions & 10 deletions debug_toolbar/templates/debug_toolbar/panels/headers.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{% load i18n %}

<h4>{% trans "Request headers" %}</h4>
<h4>{% translate "Request headers" %}</h4>

<table>
<thead>
<tr>
<th>{% trans "Key" %}</th>
<th>{% trans "Value" %}</th>
<th>{% translate "Key" %}</th>
<th>{% translate "Value" %}</th>
</tr>
</thead>
<tbody>
Expand All @@ -19,13 +19,13 @@ <h4>{% trans "Request headers" %}</h4>
</tbody>
</table>

<h4>{% trans "Response headers" %}</h4>
<h4>{% translate "Response headers" %}</h4>

<table>
<thead>
<tr>
<th>{% trans "Key" %}</th>
<th>{% trans "Value" %}</th>
<th>{% translate "Key" %}</th>
<th>{% translate "Value" %}</th>
</tr>
</thead>
<tbody>
Expand All @@ -38,15 +38,15 @@ <h4>{% trans "Response headers" %}</h4>
</tbody>
</table>

<h4>{% trans "WSGI environ" %}</h4>
<h4>{% translate "WSGI environ" %}</h4>

<p>{% trans "Since the WSGI environ inherits the environment of the server, only a significant subset is shown below." %}</p>
<p>{% translate "Since the WSGI environ inherits the environment of the server, only a significant subset is shown below." %}</p>

<table>
<thead>
<tr>
<th>{% trans "Key" %}</th>
<th>{% trans "Value" %}</th>
<th>{% translate "Key" %}</th>
<th>{% translate "Value" %}</th>
</tr>
</thead>
<tbody>
Expand Down
14 changes: 7 additions & 7 deletions debug_toolbar/templates/debug_toolbar/panels/history.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{% load i18n %}{% load static %}
{% load i18n static %}
<form method="get" action="{% url 'djdt:history_refresh' %}">
{{ refresh_form.as_div }}
<button class="refreshHistory">Refresh</button>
</form>
<table class="djdt-max-height-100">
<thead>
<tr>
<th>{% trans "Time" %}</th>
<th>{% trans "Method" %}</th>
<th>{% trans "Path" %}</th>
<th>{% trans "Request Variables" %}</th>
<th>{% trans "Status" %}</th>
<th>{% trans "Action" %}</th>
<th>{% translate "Time" %}</th>
<th>{% translate "Method" %}</th>
<th>{% translate "Path" %}</th>
<th>{% translate "Request Variables" %}</th>
<th>{% translate "Status" %}</th>
<th>{% translate "Action" %}</th>
</tr>
</thead>
<tbody id="djdtHistoryRequests">
Expand Down
4 changes: 2 additions & 2 deletions debug_toolbar/templates/debug_toolbar/panels/history_tr.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
</colgroup>
<thead>
<tr>
<th>{% trans "Variable" %}</th>
<th>{% trans "Value" %}</th>
<th>{% translate "Variable" %}</th>
<th>{% translate "Value" %}</th>
</tr>
</thead>
<tbody>
Expand Down
12 changes: 6 additions & 6 deletions debug_toolbar/templates/debug_toolbar/panels/profiling.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<table>
<thead>
<tr>
<th>{% trans "Call" %}</th>
<th>{% trans "CumTime" %}</th>
<th>{% trans "Per" %}</th>
<th>{% trans "TotTime" %}</th>
<th>{% trans "Per" %}</th>
<th>{% trans "Count" %}</th>
<th>{% translate "Call" %}</th>
<th>{% translate "CumTime" %}</th>
<th>{% translate "Per" %}</th>
<th>{% translate "TotTime" %}</th>
<th>{% translate "Per" %}</th>
<th>{% translate "Count" %}</th>
</tr>
</thead>
<tbody>
Expand Down
26 changes: 13 additions & 13 deletions debug_toolbar/templates/debug_toolbar/panels/request.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{% load i18n %}

<h4>{% trans "View information" %}</h4>
<h4>{% translate "View information" %}</h4>
<table>
<thead>
<tr>
<th>{% trans "View function" %}</th>
<th>{% trans "Arguments" %}</th>
<th>{% trans "Keyword arguments" %}</th>
<th>{% trans "URL name" %}</th>
<th>{% translate "View function" %}</th>
<th>{% translate "Arguments" %}</th>
<th>{% translate "Keyword arguments" %}</th>
<th>{% translate "URL name" %}</th>
</tr>
</thead>
<tbody>
Expand All @@ -21,29 +21,29 @@ <h4>{% trans "View information" %}</h4>
</table>

{% if cookies.list or cookies.raw %}
<h4>{% trans "Cookies" %}</h4>
<h4>{% translate "Cookies" %}</h4>
{% include 'debug_toolbar/panels/request_variables.html' with variables=cookies %}
{% else %}
<h4>{% trans "No cookies" %}</h4>
<h4>{% translate "No cookies" %}</h4>
{% endif %}

{% if session.list or session.raw %}
<h4>{% trans "Session data" %}</h4>
<h4>{% translate "Session data" %}</h4>
{% include 'debug_toolbar/panels/request_variables.html' with variables=session %}
{% else %}
<h4>{% trans "No session data" %}</h4>
<h4>{% translate "No session data" %}</h4>
{% endif %}

{% if get.list or get.raw %}
<h4>{% trans "GET data" %}</h4>
<h4>{% translate "GET data" %}</h4>
{% include 'debug_toolbar/panels/request_variables.html' with variables=get %}
{% else %}
<h4>{% trans "No GET data" %}</h4>
<h4>{% translate "No GET data" %}</h4>
{% endif %}

{% if post.list or post.raw %}
<h4>{% trans "POST data" %}</h4>
<h4>{% translate "POST data" %}</h4>
{% include 'debug_toolbar/panels/request_variables.html' with variables=post %}
{% else %}
<h4>{% trans "No POST data" %}</h4>
<h4>{% translate "No POST data" %}</h4>
{% endif %}
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
</colgroup>
<thead>
<tr>
<th>{% trans "Variable" %}</th>
<th>{% trans "Value" %}</th>
<th>{% translate "Variable" %}</th>
<th>{% translate "Value" %}</th>
</tr>
</thead>
<tbody>
Expand Down
4 changes: 2 additions & 2 deletions debug_toolbar/templates/debug_toolbar/panels/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<table>
<thead>
<tr>
<th>{% trans "Setting" %}</th>
<th>{% trans "Value" %}</th>
<th>{% translate "Setting" %}</th>
<th>{% translate "Value" %}</th>
</tr>
</thead>
<tbody>
Expand Down
4 changes: 2 additions & 2 deletions debug_toolbar/templates/debug_toolbar/panels/signals.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<table>
<thead>
<tr>
<th>{% trans "Signal" %}</th>
<th>{% trans "Receivers" %}</th>
<th>{% translate "Signal" %}</th>
<th>{% translate "Receivers" %}</th>
</tr>
</thead>
<tbody>
Expand Down
Loading