From 98a5c8a4ca03f2b2317aacbc27786a0364f112ac Mon Sep 17 00:00:00 2001 From: amickan Date: Fri, 6 Dec 2024 11:12:57 +0100 Subject: [PATCH] Rename interfaces property to avoid clash with AlgorithmInterface model field --- app/grandchallenge/algorithms/models.py | 2 +- app/grandchallenge/components/models.py | 2 +- app/grandchallenge/evaluation/models.py | 2 +- app/grandchallenge/hanging_protocols/forms.py | 9 +++++---- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/app/grandchallenge/algorithms/models.py b/app/grandchallenge/algorithms/models.py index 37c3046a7..9506ac6bf 100644 --- a/app/grandchallenge/algorithms/models.py +++ b/app/grandchallenge/algorithms/models.py @@ -444,7 +444,7 @@ def remove_user(self, user): return user.groups.remove(self.users_group) @cached_property - def interfaces(self): + def linked_component_interfaces(self): return (self.inputs.all() | self.outputs.all()).distinct() @cached_property diff --git a/app/grandchallenge/components/models.py b/app/grandchallenge/components/models.py index 3861dba1f..079afad01 100644 --- a/app/grandchallenge/components/models.py +++ b/app/grandchallenge/components/models.py @@ -2626,7 +2626,7 @@ def values_for_interfaces(self): return values_for_interfaces @cached_property - def interfaces(self): + def linked_component_interfaces(self): return ComponentInterface.objects.filter( pk__in=self.civ_sets_related_manager.exclude( values__isnull=True diff --git a/app/grandchallenge/evaluation/models.py b/app/grandchallenge/evaluation/models.py index 894ebcbb9..88b755db6 100644 --- a/app/grandchallenge/evaluation/models.py +++ b/app/grandchallenge/evaluation/models.py @@ -876,7 +876,7 @@ def set_default_interfaces(self): ) @cached_property - def interfaces(self): + def linked_component_interfaces(self): return ( self.algorithm_inputs.all() | self.algorithm_outputs.all() ).distinct() diff --git a/app/grandchallenge/hanging_protocols/forms.py b/app/grandchallenge/hanging_protocols/forms.py index 4556be190..5ed519698 100644 --- a/app/grandchallenge/hanging_protocols/forms.py +++ b/app/grandchallenge/hanging_protocols/forms.py @@ -144,7 +144,8 @@ def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) if self.instance: interface_slugs = [ - interface.slug for interface in self.instance.interfaces + interface.slug + for interface in self.instance.linked_component_interfaces ] if len(interface_slugs) > 0: @@ -176,18 +177,18 @@ def __init__(self, *args, **kwargs): def _get_interface_lists(self): images = [ interface.slug - for interface in self.instance.interfaces + for interface in self.instance.linked_component_interfaces if interface.kind == InterfaceKindChoices.IMAGE ] mandatory_isolation_interfaces = [ interface.slug - for interface in self.instance.interfaces + for interface in self.instance.linked_component_interfaces if interface.kind in InterfaceKind.interface_type_mandatory_isolation() ] overlays = [ interface.slug - for interface in self.instance.interfaces + for interface in self.instance.linked_component_interfaces if interface.kind not in ( *InterfaceKind.interface_type_undisplayable(),