From c0115aebf9300a8fdbe9972486ec605a4c6d84d3 Mon Sep 17 00:00:00 2001 From: Darek Date: Fri, 12 Jun 2026 08:32:53 -0500 Subject: [PATCH] Gate sub-components section on eligible devices via can_have_subcomponents() --- models.py | 3 +++ templates/device_detail.html | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/models.py b/models.py index bd2b060..462ebb6 100644 --- a/models.py +++ b/models.py @@ -76,6 +76,9 @@ class Device(Base): def is_subcomponent(self): return self.parent_id is not None + def can_have_subcomponents(self): + return self.parent_id is None and self.battery_slots == 0 + def effective_installed_count(self): if self.has_children(): return sum(c.installed_count() for c in self.children) diff --git a/templates/device_detail.html b/templates/device_detail.html index 32dab71..369cc17 100644 --- a/templates/device_detail.html +++ b/templates/device_detail.html @@ -108,7 +108,7 @@ -{% if device.children or not device.is_subcomponent() %} +{% if device.children or device.can_have_subcomponents() %}
{% if device.children %}

Sub-components