From e6c42a908f09c19354084a5200ff54fcee518123 Mon Sep 17 00:00:00 2001 From: sergio_gimenez Date: Tue, 5 Nov 2024 10:19:24 +0100 Subject: [PATCH] Show components and serials only if user is authenticated --- device/templates/device_web.html | 48 +++++++++++++++++--------------- device/views.py | 28 +++++++++++++++---- 2 files changed, 47 insertions(+), 29 deletions(-) diff --git a/device/templates/device_web.html b/device/templates/device_web.html index 0008e49..f63eb9d 100644 --- a/device/templates/device_web.html +++ b/device/templates/device_web.html @@ -120,10 +120,12 @@
Model
{{ object.model|default:'' }}
-
-
Serial Number
-
{{object.serial_number|default:'' }}
-
+ {% if user.is_authenticated %} +
+
Serial Number
+
{{ object.serial_number|default:'' }}
+
+ {% endif %} {% endif %} @@ -136,28 +138,28 @@ {% endfor %} - -

Components

-
- {% for component in object.components %} -
-
-
-
{{ component.type }}
-

- {% for component_key, component_value in component.items %} - {% if component_key not in 'actions,type' %} - {{ component_key }}: {{ component_value }}
- {% endif %} - {% endfor %} -

+ {% if user.is_authenticated %} +

Components

+
+ {% for component in object.components %} +
+
+
+
{{ component.type }}
+

+ {% for component_key, component_value in component.items %} + {% if component_key not in 'actions,type' %} + {{ component_key }}: {{ component_value }}
+ {% endif %} + {% endfor %} +

+
-
- {% endfor %} -
+ {% endfor %} +
+ {% endif %}
-