From 6a0d04d30053c7c257b2310810a54dc550b39d0f Mon Sep 17 00:00:00 2001 From: catborise Date: Thu, 4 Jun 2020 15:40:57 +0300 Subject: [PATCH] replace deprecated ifequal/ifnotequal with if --- computes/templates/computes.html | 16 +++++++-------- create/templates/create_instance_w2.html | 6 +++--- instances/templates/allinstances.html | 20 +++++++++---------- .../templates/allinstances_index_grouped.html | 12 +++++------ .../allinstances_index_nongrouped.html | 6 +++--- instances/templates/instance_actions.html | 12 +++++------ instances/templates/instances.html | 6 +++--- interfaces/templates/interface.html | 16 +++++++-------- interfaces/templates/interfaces.html | 4 ++-- interfaces/views.py | 2 +- networks/templates/network.html | 20 +++++++++---------- secrets/templates/secrets.html | 12 +++++------ storages/templates/create_stg_vol_block.html | 8 ++++---- storages/templates/storage.html | 8 ++++---- 14 files changed, 74 insertions(+), 74 deletions(-) diff --git a/computes/templates/computes.html b/computes/templates/computes.html index b214d5e..8b37ab2 100644 --- a/computes/templates/computes.html +++ b/computes/templates/computes.html @@ -59,7 +59,7 @@ - {% ifequal compute.type 1 %} + {% if compute.type == 1 %}
{% csrf_token %}
diff --git a/create/templates/create_instance_w2.html b/create/templates/create_instance_w2.html index 7186cd2..cd12449 100644 --- a/create/templates/create_instance_w2.html +++ b/create/templates/create_instance_w2.html @@ -140,7 +140,7 @@ {% endfor %} {% else %} - {% endif %} @@ -343,7 +343,7 @@ {% endfor %} {% else %} - {% endif %} @@ -555,7 +555,7 @@ {% endfor %} {% else %} - {% endif %} diff --git a/instances/templates/allinstances.html b/instances/templates/allinstances.html index 183744f..3a80c44 100644 --- a/instances/templates/allinstances.html +++ b/instances/templates/allinstances.html @@ -34,12 +34,12 @@ {% else %} - {% ifequal view_style "nongrouped" %} + {% if view_style == "nongrouped" %} {% include 'allinstances_index_nongrouped.html' %} - {% endifequal %} - {% ifequal view_style "grouped" %} + {% endif %} + {% if view_style == "grouped" %} {% include 'allinstances_index_grouped.html' %} - {% endifequal %} + {% endif %} {% endif %} {% else %} {% if not all_user_vms %} @@ -64,15 +64,15 @@ {% for inst, vm in all_user_vms.items %} {{ vm.name }}
{{ vm.title }} - {% ifequal vm.status 1 %} + {% if vm.status == 1 %} {% trans "Active" %} - {% endifequal %} - {% ifequal vm.status 5 %} + {% endif %} + {% if vm.status == 5 %} {% trans "Off" %} - {% endifequal %} - {% ifequal vm.status 3 %} + {% endif %} + {% if vm.status == 3 %} {% trans "Suspend" %} - {% endifequal %} + {% endif %} {{ vm.vcpu }} {{ vm.memory }} {% trans "MB" %} diff --git a/instances/templates/allinstances_index_grouped.html b/instances/templates/allinstances_index_grouped.html index feb9b7d..40ed8b0 100644 --- a/instances/templates/allinstances_index_grouped.html +++ b/instances/templates/allinstances_index_grouped.html @@ -23,9 +23,9 @@ - {% ifequal host.2 1 %}{% trans "Active" %}{% endifequal %} - {% ifequal host.2 2 %}{% trans "Not Active" %}{% endifequal %} - {% ifequal host.2 3 %}{% trans "Connection Failed" %}{% endifequal %} + {% if host.2 == 1 %}{% trans "Active" %}{% endif %} + {% if host.2 == 2 %}{% trans "Not Active" %}{% endif %} + {% if host.2 == 3 %}{% trans "Connection Failed" %}{% endif %} {{ host.3 }} {{ host.4|filesizeformat }} @@ -53,9 +53,9 @@ - {% ifequal vm.status 1 %}{% trans "Active" %}{% endifequal %} - {% ifequal vm.status 5 %}{% trans "Off" %}{% endifequal %} - {% ifequal vm.status 3 %}{% trans "Suspend" %}{% endifequal %} + {% if vm.status == 1 %}{% trans "Active" %}{% endif %} + {% if vm.status == 5 %}{% trans "Off" %}{% endif %} + {% if vm.status == 3 %}{% trans "Suspend" %}{% endif %} {{ vm.vcpu }} {{ vm.memory |filesizeformat }} diff --git a/instances/templates/allinstances_index_nongrouped.html b/instances/templates/allinstances_index_nongrouped.html index 76dad7b..a8f9da4 100644 --- a/instances/templates/allinstances_index_nongrouped.html +++ b/instances/templates/allinstances_index_nongrouped.html @@ -17,9 +17,9 @@ {{ inst }}
{{ info.title }} {{ host.1 }}
{% if info.userinstances.count > 0 %}{{ info.userinstances.first_user.user.username }}{% if info.userinstances.count > 1 %} (+{{ info.userinstances.count|add:"-1" }}){% endif %}{% endif %} - {% ifequal vm.status 1 %}{% trans "Active" %}{% endifequal %} - {% ifequal vm.status 5 %}{% trans "Off" %}{% endifequal %} - {% ifequal vm.status 3 %}{% trans "Suspend" %}{% endifequal %} + {% if vm.status == 1 %}{% trans "Active" %}{% endif %} + {% if vm.status == 5 %}{% trans "Off" %}{% endif %} + {% if vm.status == 3 %}{% trans "Suspend" %}{% endif %} {{ vm.vcpu }} {{ vm.memory|filesizeformat }} diff --git a/instances/templates/instance_actions.html b/instances/templates/instance_actions.html index 4ebc224..4a7f832 100644 --- a/instances/templates/instance_actions.html +++ b/instances/templates/instance_actions.html @@ -2,7 +2,7 @@
{% csrf_token %} - {% ifequal vm.status 5 %} + {% if vm.status == 5 %} {% if vm.is_template %} - {% endifequal %} - {% ifequal vm.status 3 %} + {% endif %} + {% if vm.status == 3 %} @@ -41,8 +41,8 @@ - {% endifequal %} - {% ifequal vm.status 1 %} + {% endif %} + {% if vm.status == 1 %} @@ -58,5 +58,5 @@ - {% endifequal %} + {% endif %}
\ No newline at end of file diff --git a/instances/templates/instances.html b/instances/templates/instances.html index e910798..20ebeae 100644 --- a/instances/templates/instances.html +++ b/instances/templates/instances.html @@ -82,9 +82,9 @@ {{ inst }}
{{ vm.title }} {% if vm.userinstances.count > 0 %}{{ vm.userinstances.first_user.user.username }}{% if vm.userinstances.count > 1 %} (+{{ vm.userinstances.count|add:"-1" }}){% endif %}{% endif %} - {% ifequal vm.status 1 %}{% trans "Active" %}{% endifequal %} - {% ifequal vm.status 5 %}{% trans "Off" %}{% endifequal %} - {% ifequal vm.status 3 %}{% trans "Suspend" %}{% endifequal %} + {% if vm.status == 1 %}{% trans "Active" %}{% endif %} + {% if vm.status == 5 %}{% trans "Off" %}{% endif %} + {% if vm.status == 3 %}{% trans "Suspend" %}{% endif %} {{ vm.vcpu }} {{ vm.memory|filesizeformat }} diff --git a/interfaces/templates/interface.html b/interfaces/templates/interface.html index 39779e1..62436f8 100644 --- a/interfaces/templates/interface.html +++ b/interfaces/templates/interface.html @@ -39,36 +39,36 @@
{% trans "Interface" %}
{{ iface }}
-
{% trans "IPv4" %} ({% ifequal ipv4 None %}{% trans 'None' %}{% else %}{{ ipv4_type }}{% endifequal %})
+
{% trans "IPv4" %} ({% if ipv4 == None %}{% trans 'None' %}{% else %}{{ ipv4_type }}{% endif %})
{{ ipv4 }}
-
{% trans "IPv6" %} ({% ifequal ipv6 None %}{% trans 'None' %}{% else %}{{ ipv6_type }}{% endifequal %})
+
{% trans "IPv6" %} ({% if ipv6 == None %}{% trans 'None' %}{% else %}{{ ipv6_type }}{% endif %})
{{ ipv6 }}
{% trans "MAC" %}
{{ mac }}
{% trans "Interface Type" %}
{{ itype }}
- {% ifequal itype 'bridge' %} + {% if itype == 'bridge' %}
{% trans "Bridge Device" %}
{{ bridge }}
- {% endifequal %} + {% endif %}
{% trans "Boot Mode" %}
{{ start_mode }}
{% trans "State" %}
{% csrf_token %} - {% ifequal state 0 %} + {% if state == 0 %} {% else %} - {% endifequal %} + {% endif %}
{% trans 'Slaves' %}
- {% ifequal itype 'bridge' %} + {% if itype == 'bridge' %} @@ -91,7 +91,7 @@ {% endfor %}
- {% endifequal %} + {% endif %}
diff --git a/interfaces/templates/interfaces.html b/interfaces/templates/interfaces.html index beab622..b6221cc 100644 --- a/interfaces/templates/interfaces.html +++ b/interfaces/templates/interfaces.html @@ -50,8 +50,8 @@ {% else %} {% for iface in ifaces_all %}
-
-
+
+
{{ iface.name }}
diff --git a/interfaces/views.py b/interfaces/views.py index 0e8a52c..b7fdcc5 100644 --- a/interfaces/views.py +++ b/interfaces/views.py @@ -1,10 +1,10 @@ from django.shortcuts import render, get_object_or_404 from django.http import HttpResponseRedirect from django.urls import reverse +from libvirt import libvirtError from computes.models import Compute from interfaces.forms import AddInterface from vrtManager.interface import wvmInterface, wvmInterfaces -from libvirt import libvirtError from admin.decorators import superuser_only diff --git a/networks/templates/network.html b/networks/templates/network.html index 41916d2..4e2bd59 100644 --- a/networks/templates/network.html +++ b/networks/templates/network.html @@ -48,22 +48,22 @@
{% trans "State" %}
{% csrf_token %} - {% ifequal state 0 %} + {% if state == 0 %} {% else %} - {% endifequal %} + {% endif %}
{% trans "Autostart" %}
{% csrf_token %} - {% ifequal autostart 0 %} + {% if autostart == 0 %} {% else %} - {% endifequal %} + {% endif %}
@@ -94,15 +94,15 @@
{% trans "IPv4 Forwarding" %}
- {% ifequal net_forward.0 'nat' %} + {% if net_forward.0 == 'nat' %} {% trans "NAT" %} - {% endifequal %} - {% ifequal net_forward.0 'route' %} + {% endif %} + {% if net_forward.0 == 'route' %} {% trans "ROUTE" %} - {% endifequal %} - {% ifequal net_forward.0 'bridge' %} + {% endif %} + {% if net_forward.0 == 'bridge' %} {% trans "BRIDGE" %} - {% endifequal %} + {% endif %} {% if not net_forward.0 %} {% trans "ISOLATE" %} {% endif %} diff --git a/secrets/templates/secrets.html b/secrets/templates/secrets.html index 4bbf1e3..18a1bd4 100644 --- a/secrets/templates/secrets.html +++ b/secrets/templates/secrets.html @@ -66,15 +66,15 @@ {% for secret in secrets_all %} {{ secret.uuid }} - {% ifequal secret.usageType 0 %} + {% if secret.usageType == 0 %} {% trans "volume" %} - {% endifequal %} - {% ifequal secret.usageType 1 %} + {% endif %} + {% if secret.usageType == 1 %} {% trans "iscsi" %} - {% endifequal %} - {% ifequal secret.usageType 2 %} + {% endif %} + {% if secret.usageType 2 %} {% trans "ceph" %} - {% endifequal %} + {% endif %} {{ secret.usage }} diff --git a/storages/templates/create_stg_vol_block.html b/storages/templates/create_stg_vol_block.html index b3169a6..18f1ac6 100644 --- a/storages/templates/create_stg_vol_block.html +++ b/storages/templates/create_stg_vol_block.html @@ -1,7 +1,7 @@ {% load i18n %} {% if request.user.is_superuser %} - {% ifnotequal state 0 %} - {% ifequal pool "iso" %} + {% if state != 0 %} + {% if pool == "iso" %} @@ -85,6 +85,6 @@
- {% endifequal %} - {% endifnotequal %} + {% endif %} + {% endif %} {% endif %} \ No newline at end of file diff --git a/storages/templates/storage.html b/storages/templates/storage.html index 87fb795..226087b 100644 --- a/storages/templates/storage.html +++ b/storages/templates/storage.html @@ -58,26 +58,26 @@
{% trans "State" %}
{% csrf_token %} - {% ifequal state 0 %} + {% if state == 0 %} {% else %} - {% endifequal %} + {% endif %}
{% trans "Autostart" %}
{% csrf_token %} - {% ifequal autostart 0 %} + {% if autostart == 0 %} {% else %} - {% endifequal %} + {% endif %}