Skip to content

Commit 53dbb32

Browse files
committed
[tests] Fixed tests for Django < 4.2
1 parent e182b17 commit 53dbb32

File tree

2 files changed

+48
-32
lines changed

2 files changed

+48
-32
lines changed

openwisp_controller/config/templates/admin/config/device/delete_confirmation.html

Lines changed: 46 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6,38 +6,54 @@
66
<link rel="stylesheet" type="text/css" href="{% static 'config/css/device-delete-confirmation.css' %}" />
77
{% endblock extrastyle %}
88

9-
{% block delete_confirm %}
10-
{% if deactivating_warning %}
11-
<div id="deactivating-warning">
12-
<ul class="messagelist">
13-
<li class="warning">
14-
<p>{% trans 'The device is still in the deactivating state, meaning its configuration is still present on the device. If you wish to remove the configuration from the device, please wait until the config status changes to "deactivated". Proceeding will delete the device from OpenWISP without ensuring its configuration has been removed.' %}</p>
15-
<form>
16-
<input type="submit" class="button danger-btn" id="warning-ack"
17-
value="{% trans 'I understand the risks, delete the device' %}">
18-
<a class="button cancel-link">{% trans 'No, take me back' %}</a>
19-
</form>
20-
</li>
9+
{% block content %}
10+
{% if perms_lacking %}
11+
<p>{% blocktranslate with escaped_object=object %}Deleting the {{ object_name }} '{{ escaped_object }}' would result in deleting related objects, but your account doesn't have permission to delete the following types of objects:{% endblocktranslate %}</p>
12+
<ul>
13+
{% for obj in perms_lacking %}
14+
<li>{{ obj }}</li>
15+
{% endfor %}
2116
</ul>
22-
</div>
17+
{% elif protected %}
18+
<p>{% blocktranslate with escaped_object=object %}Deleting the {{ object_name }} '{{ escaped_object }}' would require deleting the following protected related objects:{% endblocktranslate %}</p>
19+
<ul>
20+
{% for obj in protected %}
21+
<li>{{ obj }}</li>
22+
{% endfor %}
23+
</ul>
24+
{% else %}
25+
{% if deactivating_warning %}
26+
<div id="deactivating-warning">
27+
<ul class="messagelist">
28+
<li class="warning">
29+
<p>{% translate 'The device is still in the deactivating state, meaning its configuration is still present on the device. If you wish to remove the configuration from the device, please wait until the config status changes to "deactivated". Proceeding will delete the device from OpenWISP without ensuring its configuration has been removed.' %}</p>
30+
<form>
31+
<input type="submit" class="button danger-btn" id="warning-ack"
32+
value="{% translate 'I understand the risks, delete the device' %}">
33+
<a class="button cancel-link">{% translate 'No, take me back' %}</a>
34+
</form>
35+
</li>
36+
</ul>
37+
</div>
38+
{% endif %}
39+
<div id="delete-confirm-container" {% if deactivating_warning %}style="display:none;"{% endif %}>
40+
<p>{% blocktranslate with escaped_object=object %}Are you sure you want to delete the {{ object_name }}
41+
"{{ escaped_object }}"? All of the following related items will be deleted:{% endblocktranslate %}</p>
42+
{% include "admin/includes/object_delete_summary.html" %}
43+
<h2>{% translate "Objects" %}</h2>
44+
<ul id="deleted-objects">{{ deleted_objects|unordered_list }}</ul>
45+
<form method="post">{% csrf_token %}
46+
<div>
47+
<input type="hidden" name="post" value="yes">
48+
{% if is_popup %}<input type="hidden" name="{{ is_popup_var }}" value="1">{% endif %}
49+
{% if to_field %}<input type="hidden" name="{{ to_field_var }}" value="{{ to_field }}">{% endif %}
50+
<input type="submit" value="{% translate 'Yes, I’m sure' %}">
51+
{% if deactivating_warning %}<input type="hidden" name="force_delete" value="false">{% endif %}
52+
<a href="#" class="button cancel-link">{% translate "No, take me back" %}</a>
53+
</div>
54+
</form>
55+
</div>
2356
{% endif %}
24-
<div id="delete-confirm-container" {% if deactivating_warning %}style="display:none;"{% endif %}>
25-
<p>{% blocktranslate with escaped_object=object %}Are you sure you want to delete the {{ object_name }}
26-
"{{ escaped_object }}"? All of the following related items will be deleted:{% endblocktranslate %}</p>
27-
{% include "admin/includes/object_delete_summary.html" %}
28-
<h2>{% translate "Objects" %}</h2>
29-
<ul id="deleted-objects">{{ deleted_objects|unordered_list }}</ul>
30-
<form method="post">{% csrf_token %}
31-
<div>
32-
<input type="hidden" name="post" value="yes">
33-
{% if is_popup %}<input type="hidden" name="{{ is_popup_var }}" value="1">{% endif %}
34-
{% if to_field %}<input type="hidden" name="{{ to_field_var }}" value="{{ to_field }}">{% endif %}
35-
<input type="submit" value="{% translate 'Yes, I’m sure' %}">
36-
{% if deactivating_warning %}<input type="hidden" name="force_delete" value="false">{% endif %}
37-
<a href="#" class="button cancel-link">{% translate "No, take me back" %}</a>
38-
</div>
39-
</form>
40-
</div>
4157
{% endblock %}
4258

4359
{% block footer %}

openwisp_controller/config/templates/admin/config/device/delete_selected_confirmation.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@
1919
<ul class="messagelist">
2020
<li class="warning">
2121
<p>
22-
{% blocktrans count counter=active_devices|length %}
22+
{% blocktranslate count counter=active_devices|length %}
2323
The following device you selected for deletion is not deactivated
2424
(either it is active or its configuration status is still "deactivating"):
2525
{% plural %}
2626
The following devices you selected for deletion are not deactivated
2727
(either they are active or their configuration status is still "deactivating"):
28-
{% endblocktrans %}
28+
{% endblocktranslate %}
2929
</p>
3030
<ul>{{ active_devices|unordered_list }}</ul>
3131
<p>

0 commit comments

Comments
 (0)