Revert application of gettext() to column template code

This commit is contained in:
Jeremy Stretch 2023-07-31 13:52:00 -04:00
parent dad962c3d8
commit afd5c46722
4 changed files with 28 additions and 30 deletions

View File

@ -1,5 +1,3 @@
from django.utils.translation import gettext_lazy as _
LINKTERMINATION = """ LINKTERMINATION = """
{% for termination in value %} {% for termination in value %}
{% if termination.parent_object %} {% if termination.parent_object %}
@ -22,11 +20,11 @@ WEIGHT = """
{% if value %}{{ value|floatformat:"-2" }} {{ record.weight_unit }}{% endif %} {% if value %}{{ value|floatformat:"-2" }} {{ record.weight_unit }}{% endif %}
""" """
DEVICE_LINK = _(""" DEVICE_LINK = """
{{ value|default:'<span class="badge bg-info">Unnamed device</span>' }} {{ value|default:'<span class="badge bg-info">Unnamed device</span>' }}
""") """
DEVICEBAY_STATUS = _(""" DEVICEBAY_STATUS = """
{% if record.installed_device_id %} {% if record.installed_device_id %}
<span class="badge bg-{{ record.installed_device.get_status_color }}"> <span class="badge bg-{{ record.installed_device.get_status_color }}">
{{ record.installed_device.get_status_display }} {{ record.installed_device.get_status_display }}
@ -34,7 +32,7 @@ DEVICEBAY_STATUS = _("""
{% else %} {% else %}
<span class="badge bg-secondary">Vacant</span> <span class="badge bg-secondary">Vacant</span>
{% endif %} {% endif %}
""") """
INTERFACE_IPADDRESSES = """ INTERFACE_IPADDRESSES = """
<div class="table-badge-group"> <div class="table-badge-group">
@ -56,7 +54,7 @@ INTERFACE_FHRPGROUPS = """
</div> </div>
""" """
INTERFACE_TAGGED_VLANS = _(""" INTERFACE_TAGGED_VLANS = """
{% if record.mode == 'tagged' %} {% if record.mode == 'tagged' %}
{% for vlan in value.all %} {% for vlan in value.all %}
<a href="{{ vlan.get_absolute_url }}">{{ vlan }}</a><br /> <a href="{{ vlan.get_absolute_url }}">{{ vlan }}</a><br />
@ -64,7 +62,7 @@ INTERFACE_TAGGED_VLANS = _("""
{% elif record.mode == 'tagged-all' %} {% elif record.mode == 'tagged-all' %}
All All
{% endif %} {% endif %}
""") """
INTERFACE_WIRELESS_LANS = """ INTERFACE_WIRELESS_LANS = """
{% for wlan in value.all %} {% for wlan in value.all %}
@ -108,7 +106,7 @@ MODULAR_COMPONENT_TEMPLATE_BUTTONS = """
# Device component buttons # Device component buttons
# #
CONSOLEPORT_BUTTONS = _(""" CONSOLEPORT_BUTTONS = """
{% if perms.dcim.add_inventoryitem %} {% if perms.dcim.add_inventoryitem %}
<a href="{% url 'dcim:inventoryitem_add' %}?device={{ record.device_id }}&component_type={{ record|content_type_id }}&component_id={{ record.pk }}&return_url={% url 'dcim:device_consoleports' pk=object.pk %}" class="btn btn-sm btn-success" title="Add inventory item"> <a href="{% url 'dcim:inventoryitem_add' %}?device={{ record.device_id }}&component_type={{ record|content_type_id }}&component_id={{ record.pk }}&return_url={% url 'dcim:device_consoleports' pk=object.pk %}" class="btn btn-sm btn-success" title="Add inventory item">
<i class="mdi mdi-plus-thick" aria-hidden="true"></i> <i class="mdi mdi-plus-thick" aria-hidden="true"></i>
@ -156,9 +154,9 @@ CONSOLEPORT_BUTTONS = _("""
{% else %} {% else %}
<a href="#" class="btn btn-outline-dark btn-sm disabled"><i class="mdi mdi-ethernet-cable" aria-hidden="true"></i></a> <a href="#" class="btn btn-outline-dark btn-sm disabled"><i class="mdi mdi-ethernet-cable" aria-hidden="true"></i></a>
{% endif %} {% endif %}
""") """
CONSOLESERVERPORT_BUTTONS = _(""" CONSOLESERVERPORT_BUTTONS = """
{% if perms.dcim.add_inventoryitem %} {% if perms.dcim.add_inventoryitem %}
<a href="{% url 'dcim:inventoryitem_add' %}?device={{ record.device_id }}&component_type={{ record|content_type_id }}&component_id={{ record.pk }}&return_url={% url 'dcim:device_consoleserverports' pk=object.pk %}" class="btn btn-sm btn-success" title="Add inventory item"> <a href="{% url 'dcim:inventoryitem_add' %}?device={{ record.device_id }}&component_type={{ record|content_type_id }}&component_id={{ record.pk }}&return_url={% url 'dcim:device_consoleserverports' pk=object.pk %}" class="btn btn-sm btn-success" title="Add inventory item">
<i class="mdi mdi-plus-thick" aria-hidden="true"></i> <i class="mdi mdi-plus-thick" aria-hidden="true"></i>
@ -206,9 +204,9 @@ CONSOLESERVERPORT_BUTTONS = _("""
{% else %} {% else %}
<a href="#" class="btn btn-outline-dark btn-sm disabled"><i class="mdi mdi-ethernet-cable" aria-hidden="true"></i></a> <a href="#" class="btn btn-outline-dark btn-sm disabled"><i class="mdi mdi-ethernet-cable" aria-hidden="true"></i></a>
{% endif %} {% endif %}
""") """
POWERPORT_BUTTONS = _(""" POWERPORT_BUTTONS = """
{% if perms.dcim.add_inventoryitem %} {% if perms.dcim.add_inventoryitem %}
<a href="{% url 'dcim:inventoryitem_add' %}?device={{ record.device_id }}&component_type={{ record|content_type_id }}&component_id={{ record.pk }}&return_url={% url 'dcim:device_powerports' pk=object.pk %}" class="btn btn-sm btn-primary" title="Add inventory item"> <a href="{% url 'dcim:inventoryitem_add' %}?device={{ record.device_id }}&component_type={{ record|content_type_id }}&component_id={{ record.pk }}&return_url={% url 'dcim:device_powerports' pk=object.pk %}" class="btn btn-sm btn-primary" title="Add inventory item">
<i class="mdi mdi-plus-thick" aria-hidden="true"></i> <i class="mdi mdi-plus-thick" aria-hidden="true"></i>
@ -255,9 +253,9 @@ POWERPORT_BUTTONS = _("""
{% else %} {% else %}
<a href="#" class="btn btn-outline-dark btn-sm disabled"><i class="mdi mdi-ethernet-cable" aria-hidden="true"></i></a> <a href="#" class="btn btn-outline-dark btn-sm disabled"><i class="mdi mdi-ethernet-cable" aria-hidden="true"></i></a>
{% endif %} {% endif %}
""") """
POWEROUTLET_BUTTONS = _(""" POWEROUTLET_BUTTONS = """
{% if perms.dcim.add_inventoryitem %} {% if perms.dcim.add_inventoryitem %}
<a href="{% url 'dcim:inventoryitem_add' %}?device={{ record.device_id }}&component_type={{ record|content_type_id }}&component_id={{ record.pk }}&return_url={% url 'dcim:device_poweroutlets' pk=object.pk %}" class="btn btn-sm btn-primary" title="Add inventory item"> <a href="{% url 'dcim:inventoryitem_add' %}?device={{ record.device_id }}&component_type={{ record|content_type_id }}&component_id={{ record.pk }}&return_url={% url 'dcim:device_poweroutlets' pk=object.pk %}" class="btn btn-sm btn-primary" title="Add inventory item">
<i class="mdi mdi-plus-thick" aria-hidden="true"></i> <i class="mdi mdi-plus-thick" aria-hidden="true"></i>
@ -300,9 +298,9 @@ POWEROUTLET_BUTTONS = _("""
<a href="#" class="btn btn-outline-dark btn-sm disabled"><i class="mdi mdi-ethernet-cable" aria-hidden="true"></i></a> <a href="#" class="btn btn-outline-dark btn-sm disabled"><i class="mdi mdi-ethernet-cable" aria-hidden="true"></i></a>
{% endif %} {% endif %}
{% endif %} {% endif %}
""") """
INTERFACE_BUTTONS = _(""" INTERFACE_BUTTONS = """
{% if perms.dcim.change_interface %} {% if perms.dcim.change_interface %}
<span class="dropdown"> <span class="dropdown">
<button type="button" class="btn btn-primary btn-sm dropdown-toggle" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false" title="Add"> <button type="button" class="btn btn-primary btn-sm dropdown-toggle" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false" title="Add">
@ -384,9 +382,9 @@ INTERFACE_BUTTONS = _("""
<span class="mdi mdi-wifi-plus" aria-hidden="true"></span> <span class="mdi mdi-wifi-plus" aria-hidden="true"></span>
</a> </a>
{% endif %} {% endif %}
""") """
FRONTPORT_BUTTONS = _(""" FRONTPORT_BUTTONS = """
{% if perms.dcim.add_inventoryitem %} {% if perms.dcim.add_inventoryitem %}
<a href="{% url 'dcim:inventoryitem_add' %}?device={{ record.device_id }}&component_type={{ record|content_type_id }}&component_id={{ record.pk }}&return_url={% url 'dcim:device_frontports' pk=object.pk %}" class="btn btn-sm btn-primary" title="Add inventory item"> <a href="{% url 'dcim:inventoryitem_add' %}?device={{ record.device_id }}&component_type={{ record|content_type_id }}&component_id={{ record.pk }}&return_url={% url 'dcim:device_frontports' pk=object.pk %}" class="btn btn-sm btn-primary" title="Add inventory item">
<i class="mdi mdi-plus-thick" aria-hidden="true"></i> <i class="mdi mdi-plus-thick" aria-hidden="true"></i>
@ -439,9 +437,9 @@ FRONTPORT_BUTTONS = _("""
<a href="#" class="btn btn-outline-dark btn-sm disabled"><i class="mdi mdi-ethernet-cable" aria-hidden="true"></i></a> <a href="#" class="btn btn-outline-dark btn-sm disabled"><i class="mdi mdi-ethernet-cable" aria-hidden="true"></i></a>
{% endif %} {% endif %}
{% endif %} {% endif %}
""") """
REARPORT_BUTTONS = _(""" REARPORT_BUTTONS = """
{% if perms.dcim.add_inventoryitem %} {% if perms.dcim.add_inventoryitem %}
<a href="{% url 'dcim:inventoryitem_add' %}?device={{ record.device_id }}&component_type={{ record|content_type_id }}&component_id={{ record.pk }}&return_url={% url 'dcim:device_rearports' pk=object.pk %}" class="btn btn-sm btn-primary" title="Add inventory item"> <a href="{% url 'dcim:inventoryitem_add' %}?device={{ record.device_id }}&component_type={{ record|content_type_id }}&component_id={{ record.pk }}&return_url={% url 'dcim:device_rearports' pk=object.pk %}" class="btn btn-sm btn-primary" title="Add inventory item">
<i class="mdi mdi-plus-thick" aria-hidden="true"></i> <i class="mdi mdi-plus-thick" aria-hidden="true"></i>
@ -494,7 +492,7 @@ REARPORT_BUTTONS = _("""
<a href="#" class="btn btn-outline-dark btn-sm disabled"><i class="mdi mdi-ethernet-cable" aria-hidden="true"></i></a> <a href="#" class="btn btn-outline-dark btn-sm disabled"><i class="mdi mdi-ethernet-cable" aria-hidden="true"></i></a>
{% endif %} {% endif %}
{% endif %} {% endif %}
""") """
DEVICEBAY_BUTTONS = """ DEVICEBAY_BUTTONS = """
{% if perms.dcim.change_devicebay %} {% if perms.dcim.change_devicebay %}

View File

@ -18,7 +18,7 @@ __all__ = (
'RoleTable', 'RoleTable',
) )
AVAILABLE_LABEL = mark_safe(_('<span class="badge bg-success">Available</span>')) AVAILABLE_LABEL = mark_safe('<span class="badge bg-success">Available</span>')
AGGREGATE_COPY_BUTTON = """ AGGREGATE_COPY_BUTTON = """
{% copy_content record.pk prefix="aggregate_" %} {% copy_content record.pk prefix="aggregate_" %}
@ -47,7 +47,7 @@ PREFIX_LINK_WITH_DEPTH = """
{% endif %} {% endif %}
""" + PREFIX_LINK """ + PREFIX_LINK
IPADDRESS_LINK = _(""" IPADDRESS_LINK = """
{% if record.pk %} {% if record.pk %}
<a href="{{ record.get_absolute_url }}" id="ipaddress_{{ record.pk }}">{{ record.address }}</a> <a href="{{ record.get_absolute_url }}" id="ipaddress_{{ record.pk }}">{{ record.address }}</a>
{% elif perms.ipam.add_ipaddress %} {% elif perms.ipam.add_ipaddress %}
@ -55,7 +55,7 @@ IPADDRESS_LINK = _("""
{% else %} {% else %}
{% if record.0 <= 65536 %}{{ record.0 }}{% else %}Many{% endif %} IP{{ record.0|pluralize }} available {% if record.0 <= 65536 %}{{ record.0 }}{% else %}Many{% endif %} IP{{ record.0|pluralize }} available
{% endif %} {% endif %}
""") """
IPADDRESS_COPY_BUTTON = """ IPADDRESS_COPY_BUTTON = """
{% copy_content record.pk prefix="ipaddress_" %} {% copy_content record.pk prefix="ipaddress_" %}

View File

@ -18,9 +18,9 @@ __all__ = (
'VLANVirtualMachinesTable', 'VLANVirtualMachinesTable',
) )
AVAILABLE_LABEL = mark_safe(_('<span class="badge bg-success">Available</span>')) AVAILABLE_LABEL = mark_safe('<span class="badge bg-success">Available</span>')
VLAN_LINK = _(""" VLAN_LINK = """
{% if record.pk %} {% if record.pk %}
<a href="{{ record.get_absolute_url }}">{{ record.vid }}</a> <a href="{{ record.get_absolute_url }}">{{ record.vid }}</a>
{% elif perms.ipam.add_vlan %} {% elif perms.ipam.add_vlan %}
@ -28,7 +28,7 @@ VLAN_LINK = _("""
{% else %} {% else %}
{{ record.available }} VLAN{{ record.available|pluralize }} available {{ record.available }} VLAN{{ record.available|pluralize }} available
{% endif %} {% endif %}
""") """
VLAN_PREFIXES = """ VLAN_PREFIXES = """
{% for prefix in value.all %} {% for prefix in value.all %}

View File

@ -12,7 +12,7 @@ __all__ = (
'VMInterfaceTable', 'VMInterfaceTable',
) )
VMINTERFACE_BUTTONS = _(""" VMINTERFACE_BUTTONS = """
{% if perms.virtualization.change_vminterface %} {% if perms.virtualization.change_vminterface %}
<span class="dropdown"> <span class="dropdown">
<button type="button" class="btn btn-primary btn-sm dropdown-toggle" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false" title="Add"> <button type="button" class="btn btn-primary btn-sm dropdown-toggle" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false" title="Add">
@ -31,7 +31,7 @@ VMINTERFACE_BUTTONS = _("""
</ul> </ul>
</span> </span>
{% endif %} {% endif %}
""") """
# #