[PATCH 1/5] templates: Replace ifequal and ifnotequal with if

Andrew Donnellan ajd at linux.ibm.com
Fri Aug 28 00:14:02 AEST 2020


Django 3.1 deprecates the ifequal and ifnotequal tags, for removal in 4.0.
Replace all occurrences of ifequal and ifnotequal with if.

Signed-off-by: Andrew Donnellan <ajd at linux.ibm.com>
---
 .../patchwork/partials/pagination.html        |  8 ++++----
 .../patchwork/partials/patch-list.html        | 20 +++++++++----------
 patchwork/templates/patchwork/profile.html    |  4 ++--
 3 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/patchwork/templates/patchwork/partials/pagination.html b/patchwork/templates/patchwork/partials/pagination.html
index 04f4d16671c2..ee4b555d62c2 100644
--- a/patchwork/templates/patchwork/partials/pagination.html
+++ b/patchwork/templates/patchwork/partials/pagination.html
@@ -1,6 +1,6 @@
 {% load listurl %}
 
-{% ifnotequal page.paginator.num_pages 1 %}
+{% if page.paginator.num_pages != 1 %}
 <div class="paginator">
 {% if page.has_previous %}
  <span class="prev">
@@ -18,12 +18,12 @@
 {% endif %}
 
 {% for p in page.paginator.adjacent_set %}
-  {% ifequal p page.number %}
+  {% if p == page.number %}
     <span class="curr" title="Current Page">{{ p }}</span>
   {% else %}
     <span class="page"><a href="{% listurl page=p %}"
      title="Page {{ p }}">{{ p }}</a></span>
-  {% endifequal %}
+  {% endif %}
 {% endfor %}
 
 {% if page.paginator.leading_set %}
@@ -42,4 +42,4 @@
  <span class="next-na">»</span>
 {% endif %}
 </div>
-{% endifnotequal %}
+{% endif %}
diff --git a/patchwork/templates/patchwork/partials/patch-list.html b/patchwork/templates/patchwork/partials/patch-list.html
index 985e9bee05a0..02d6dff87c97 100644
--- a/patchwork/templates/patchwork/partials/patch-list.html
+++ b/patchwork/templates/patchwork/partials/patch-list.html
@@ -71,7 +71,7 @@ $(document).ready(function() {
    {% endif %}
 
    <th>
-    {% ifequal order.name "name" %}
+    {% if order.name == "name" %}
      <a class="colactive" href="{% listurl order=order.reversed_name %}">
       <span class="glyphicon glyphicon-chevron-{{ order.updown }}"></span>
      </a>
@@ -84,7 +84,7 @@ $(document).ready(function() {
      {% else %}
      <span class="colinactive">Patch</span>
      {% endif %}
-    {% endifequal %}
+    {% endif %}
    </th>
 
    <th>
@@ -100,7 +100,7 @@ $(document).ready(function() {
    </th>
 
    <th>
-    {% ifequal order.name "date" %}
+    {% if order.name == "date" %}
      <a class="colactive" href="{% listurl order=order.reversed_name %}">
       <span class="glyphicon glyphicon-chevron-{{ order.updown }}"></span>
      </a>
@@ -113,11 +113,11 @@ $(document).ready(function() {
      {% else %}
      <span class="colinactive">Date</span>
      {% endif %}
-    {% endifequal %}
+    {% endif %}
    </th>
 
    <th>
-    {% ifequal order.name "submitter" %}
+    {% if order.name == "submitter" %}
      <a class="colactive" href="{% listurl order=order.reversed_name %}">
       <span class="glyphicon glyphicon-chevron-{{ order.updown }}"></span>
      </a>
@@ -132,11 +132,11 @@ $(document).ready(function() {
      {% else %}
      <span class="colinactive">Submitter</span>
      {% endif %}
-    {% endifequal %}
+    {% endif %}
    </th>
 
    <th>
-    {% ifequal order.name "delegate" %}
+    {% if order.name == "delegate" %}
      <a class="colactive" href="{% listurl order=order.reversed_name %}">
       <span class="glyphicon glyphicon-chevron-{{ order.updown }}"></span>
      </a>
@@ -149,11 +149,11 @@ $(document).ready(function() {
      {% else %}
      <span class="colinactive">Delegate</span>
      {% endif %}
-    {% endifequal %}
+    {% endif %}
    </th>
 
    <th>
-    {% ifequal order.name "state" %}
+    {% if order.name == "state" %}
      <a class="colactive" href="{% listurl order=order.reversed_name %}">
       <span class="glyphicon glyphicon-chevron-{{ order.updown }}"></span>
      </a>
@@ -166,7 +166,7 @@ $(document).ready(function() {
      {% else %}
      <span class="colinactive">State</span>
      {% endif %}
-    {% endifequal %}
+    {% endif %}
    </th>
 
   </tr>
diff --git a/patchwork/templates/patchwork/profile.html b/patchwork/templates/patchwork/profile.html
index 4ca78dae430e..4a4b55826d03 100644
--- a/patchwork/templates/patchwork/profile.html
+++ b/patchwork/templates/patchwork/profile.html
@@ -55,13 +55,13 @@ address.</p>
  <tr>
   <td>{{ email.email }}</td>
   <td>
-  {% ifnotequal user.email email.email %}
+  {% if user.email != email.email %}
    <form action="{% url 'user-unlink' person_id=email.id %}"
     method="post">
     {% csrf_token %}
     <input type="submit" value="Unlink"/>
    </form>
-    {% endifnotequal %}
+    {% endif %}
   </td>
   <td>
    {% if email.is_optout %}
-- 
2.20.1



More information about the Patchwork mailing list