From ed0624662dc80dda3f4f3ee9c72e948432bd2abc Mon Sep 17 00:00:00 2001 From: Roman P Date: Tue, 28 May 2019 18:40:24 +0400 Subject: [PATCH 1/2] Titlecase conversion of None Closes #212 --- .../device_registry/templates/device_info_security.html | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/backend/device_registry/templates/device_info_security.html b/backend/device_registry/templates/device_info_security.html index 150adb463..444b4cd93 100644 --- a/backend/device_registry/templates/device_info_security.html +++ b/backend/device_registry/templates/device_info_security.html @@ -93,12 +93,13 @@

Security

Firewall Enabled - {{ object.firewallstate.enabled|title|default_if_none:'N/A' }} - {% if object.firewallstate.enabled is not None %} - + {% if object.firewallstate.enabled is None %}N/A{% else %} + {{ object.firewallstate.enabled|title }}{% endif %} + {% if object.firewallstate.enabled is not None %} + {{ object.firewallstate.enabled|yesno:"✓,✗" }} - {% endif %} + {% endif %} From 4d41134b0191791357ebb691aab17d9917fc83a6 Mon Sep 17 00:00:00 2001 From: Roman P Date: Tue, 28 May 2019 21:41:38 +0400 Subject: [PATCH 2/2] A portion of improvements - handle all '|title' filter usages - use one 'if' instead of 2 --- .../templates/device_info_security.html | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/backend/device_registry/templates/device_info_security.html b/backend/device_registry/templates/device_info_security.html index 444b4cd93..b8ff70da6 100644 --- a/backend/device_registry/templates/device_info_security.html +++ b/backend/device_registry/templates/device_info_security.html @@ -60,25 +60,27 @@

Security

AppArmor Enabled - - {{ object.deviceinfo.app_armor_enabled|title|default_if_none:'N/A' }} - {% if object.deviceinfo.app_armor_enabled is not None %} - + + {% if object.deviceinfo.app_armor_enabled is None %}N/A{% else %} + {{ object.deviceinfo.app_armor_enabled|title }} + {{ object.deviceinfo.app_armor_enabled|yesno:"✓,✗" }} - {% endif %} - + {% endif %} + Default Password Detected - - {{ object.deviceinfo.default_password|title|default_if_none:'N/A' }} - {% if object.deviceinfo.default_password is not None %} - + + {% if object.deviceinfo.default_password is None %}N/A{% else %} + {{ object.deviceinfo.default_password|title }} + {{ object.deviceinfo.default_password|yesno:"✗,✓" }} - {% endif %} - + {% endif %} + Logins @@ -94,8 +96,7 @@

Security

Firewall Enabled {% if object.firewallstate.enabled is None %}N/A{% else %} - {{ object.firewallstate.enabled|title }}{% endif %} - {% if object.firewallstate.enabled is not None %} + {{ object.firewallstate.enabled|title }} {{ object.firewallstate.enabled|yesno:"✓,✗" }}