diff --git a/netbox/templates/dcim/devicerole.html b/netbox/templates/dcim/devicerole.html
index 4db2d3ad8a4..288101c08a7 100644
--- a/netbox/templates/dcim/devicerole.html
+++ b/netbox/templates/dcim/devicerole.html
@@ -40,13 +40,7 @@
| VM Role |
-
- {% if object.vm_role %}
-
- {% else %}
-
- {% endif %}
- |
+ {% checkmark object.vm_role %} |
| Devices |
diff --git a/netbox/templates/dcim/devicetype.html b/netbox/templates/dcim/devicetype.html
index 21a04e7d021..4b9dc8db7c0 100644
--- a/netbox/templates/dcim/devicetype.html
+++ b/netbox/templates/dcim/devicetype.html
@@ -33,13 +33,7 @@
| Full Depth |
-
- {% if object.is_full_depth %}
-
- {% else %}
-
- {% endif %}
- |
+ {% checkmark object.is_full_depth %} |
| Parent/Child |
diff --git a/netbox/templates/dcim/interface.html b/netbox/templates/dcim/interface.html
index bd0569c397a..5eaa99c3f42 100644
--- a/netbox/templates/dcim/interface.html
+++ b/netbox/templates/dcim/interface.html
@@ -48,23 +48,11 @@
| Enabled |
-
- {% if object.enabled %}
-
- {% else %}
-
- {% endif %}
- |
+ {% checkmark object.enabled %} |
| Management Only |
-
- {% if object.mgmt_only %}
-
- {% else %}
-
- {% endif %}
- |
+ {% checkmark object.mgmt_only %} |
| Parent |
diff --git a/netbox/templates/dcim/virtualchassis.html b/netbox/templates/dcim/virtualchassis.html
index eadf1645de0..2e1344f71dd 100644
--- a/netbox/templates/dcim/virtualchassis.html
+++ b/netbox/templates/dcim/virtualchassis.html
@@ -65,7 +65,7 @@
{% if object.master == vc_member %}
-
+ {% checkmark True %}
{% endif %}
|
diff --git a/netbox/templates/extras/customfield.html b/netbox/templates/extras/customfield.html
index bf79059b804..9be7a485a6b 100644
--- a/netbox/templates/extras/customfield.html
+++ b/netbox/templates/extras/customfield.html
@@ -29,13 +29,7 @@
|
| Required |
-
- {% if object.required %}
-
- {% else %}
-
- {% endif %}
- |
+ {% checkmark object.required %} |
| Weight |
diff --git a/netbox/templates/extras/customlink.html b/netbox/templates/extras/customlink.html
index 42b2f6118a6..ebf50882c9a 100644
--- a/netbox/templates/extras/customlink.html
+++ b/netbox/templates/extras/customlink.html
@@ -33,13 +33,7 @@
| New Window |
-
- {% if object.new_window %}
-
- {% else %}
-
- {% endif %}
- |
+ {% checkmark object.new_window %} |
diff --git a/netbox/templates/extras/exporttemplate.html b/netbox/templates/extras/exporttemplate.html
index 07b98ee9367..912702b863a 100644
--- a/netbox/templates/extras/exporttemplate.html
+++ b/netbox/templates/extras/exporttemplate.html
@@ -40,13 +40,7 @@
| Attachment |
-
- {% if object.as_attachment %}
-
- {% else %}
-
- {% endif %}
- |
+ {% checkmark object.as_attachment %} |
diff --git a/netbox/templates/extras/webhook.html b/netbox/templates/extras/webhook.html
index ab53c56a286..6891930bc41 100644
--- a/netbox/templates/extras/webhook.html
+++ b/netbox/templates/extras/webhook.html
@@ -17,13 +17,7 @@
| Enabled |
-
- {% if object.enabled %}
-
- {% else %}
-
- {% endif %}
- |
+ {% checkmark object.enabled %} |
@@ -36,33 +30,15 @@
| Create |
-
- {% if object.type_create %}
-
- {% else %}
-
- {% endif %}
- |
+ {% checkmark object.type_create %} |
| Update |
-
- {% if object.type_update %}
-
- {% else %}
-
- {% endif %}
- |
+ {% checkmark object.type_update %} |
| Delete |
-
- {% if object.type_delete %}
-
- {% else %}
-
- {% endif %}
- |
+ {% checkmark object.type_delete %} |
@@ -100,13 +76,7 @@
| SSL Verification |
-
- {% if object.ssl_verification %}
-
- {% else %}
-
- {% endif %}
- |
+ {% checkmark object.ssl_verification %} |
| CA File Path |
diff --git a/netbox/templates/generic/object_bulk_import.html b/netbox/templates/generic/object_bulk_import.html
index 2d5957268b0..26ab2edf29e 100644
--- a/netbox/templates/generic/object_bulk_import.html
+++ b/netbox/templates/generic/object_bulk_import.html
@@ -66,7 +66,7 @@
{% if field.required %}
-
+ {% checkmark True true="Required" %}
{% else %}
—
{% endif %}
diff --git a/netbox/templates/inc/panels/custom_fields.html b/netbox/templates/inc/panels/custom_fields.html
index b979cc073d5..b48a43f1c22 100644
--- a/netbox/templates/inc/panels/custom_fields.html
+++ b/netbox/templates/inc/panels/custom_fields.html
@@ -15,9 +15,9 @@
{% if field.type == 'longtext' and value %}
{{ value|render_markdown }}
{% elif field.type == 'boolean' and value == True %}
-
+ {% checkmark value true="True" %}
{% elif field.type == 'boolean' and value == False %}
-
+ {% checkmark value false="False" %}
{% elif field.type == 'url' and value %}
{{ value|truncatechars:70 }}
{% elif field.type == 'json' and value %}
diff --git a/netbox/templates/ipam/prefix.html b/netbox/templates/ipam/prefix.html
index c7c0a441e51..c3d3bdeddb0 100644
--- a/netbox/templates/ipam/prefix.html
+++ b/netbox/templates/ipam/prefix.html
@@ -94,13 +94,7 @@
|
| Is a pool |
-
- {% if object.is_pool %}
-
- {% else %}
-
- {% endif %}
- |
+ {% checkmark object.is_pool %} |
diff --git a/netbox/templates/ipam/rir.html b/netbox/templates/ipam/rir.html
index 0c38855b51a..555fed1dee3 100644
--- a/netbox/templates/ipam/rir.html
+++ b/netbox/templates/ipam/rir.html
@@ -30,13 +30,7 @@
| Private |
-
- {% if object.is_private %}
-
- {% else %}
-
- {% endif %}
- |
+ {% checkmark object.is_private %} |
| Aggregates |
diff --git a/netbox/templates/ipam/vrf.html b/netbox/templates/ipam/vrf.html
index 349fe20d36f..ae4f65887cd 100644
--- a/netbox/templates/ipam/vrf.html
+++ b/netbox/templates/ipam/vrf.html
@@ -30,13 +30,7 @@
| Unique IP Space |
-
- {% if object.enforce_unique %}
-
- {% else %}
-
- {% endif %}
- |
+ {% checkmark object.enforce_unique %} |
| Description |
diff --git a/netbox/templates/users/profile.html b/netbox/templates/users/profile.html
index 460ca63e76b..112603126ca 100644
--- a/netbox/templates/users/profile.html
+++ b/netbox/templates/users/profile.html
@@ -35,23 +35,11 @@
| Superuser |
-
- {% if request.user.is_superuser %}
-
- {% else %}
-
- {% endif %}
- |
+ {% checkmark request.user.is_superuser %} |
| Admin Access |
-
- {% if request.user.is_staff %}
-
- {% else %}
-
- {% endif %}
- |
+ {% checkmark request.user.is_staff %} |
diff --git a/netbox/utilities/templates/helpers/checkmark.html b/netbox/utilities/templates/helpers/checkmark.html
new file mode 100644
index 00000000000..e4eacae016a
--- /dev/null
+++ b/netbox/utilities/templates/helpers/checkmark.html
@@ -0,0 +1,5 @@
+{% if value %}
+
+{% elif show_false %}
+
+{% endif %}
diff --git a/netbox/utilities/templatetags/helpers.py b/netbox/utilities/templatetags/helpers.py
index c054785fc70..0e45cb581c3 100644
--- a/netbox/utilities/templatetags/helpers.py
+++ b/netbox/utilities/templatetags/helpers.py
@@ -426,6 +426,23 @@ def badge(value, bg_class='secondary', show_empty=False):
}
+@register.inclusion_tag('helpers/checkmark.html')
+def checkmark(value, show_false=True, true='Yes', false='No'):
+ """
+ Display either a green checkmark or red X to indicate a boolean value.
+
+ :param show_false: Display a red X if the value is False
+ :param true: Text label for true value
+ :param false: Text label for false value
+ """
+ return {
+ 'value': bool(value),
+ 'show_false': show_false,
+ 'true_label': true,
+ 'false_label': false,
+ }
+
+
@register.inclusion_tag('helpers/table_config_form.html')
def table_config_form(table, table_name=None):
return {