From e2c3eecc63fce0e2224ee92482753bb0f7efc08c Mon Sep 17 00:00:00 2001 From: Ross Date: Wed, 17 Dec 2025 16:28:57 +0000 Subject: [PATCH] Enhance constraint display in rota detail view with default value indication and improved layout --- .../djangorota/templates/rota/rota_detail.html | 14 +++++++++++++- djangorota/rota/views.py | 9 ++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/djangorota/djangorota/templates/rota/rota_detail.html b/djangorota/djangorota/templates/rota/rota_detail.html index d52e5d6..c02092f 100644 --- a/djangorota/djangorota/templates/rota/rota_detail.html +++ b/djangorota/djangorota/templates/rota/rota_detail.html @@ -42,7 +42,19 @@ {% for key, info in configured_constraints.items %} {{ key }} -
{{ info.pretty }}
+ + {% if info.typed and info.default is not None %} + {% if info.value == info.default %} +
{{ info.pretty }}
+ default + {% else %} +
{{ info.pretty }}
+
Default: {{ info.default }}
+ {% endif %} + {% else %} +
{{ info.pretty }}
+ {% endif %} + Edit
diff --git a/djangorota/rota/views.py b/djangorota/rota/views.py index 19afde7..29df807 100644 --- a/djangorota/rota/views.py +++ b/djangorota/rota/views.py @@ -176,7 +176,14 @@ def rota_detail(request, rota_id): desc = available_constraints_rich.get(k, {}).get("description") except Exception: desc = None - configured_constraints[k] = {"value": v, "pretty": pretty, "typed": (k in available_constraints_rich), "description": desc} + default_val = available_constraints_rich.get(k, {}).get("default") + configured_constraints[k] = { + "value": v, + "pretty": pretty, + "typed": (k in available_constraints_rich), + "description": desc, + "default": default_val, + } except Exception: configured_constraints = {}