From 1267ca430b4d7ae20bde0890e545fe4723fea19c Mon Sep 17 00:00:00 2001 From: Rob van der Linde Date: Fri, 15 Mar 2024 01:13:56 +1300 Subject: [PATCH] resource: fix container resource children can't be in a list When I put the children in a list under the key "children" it completely broke traversal. It means /Users/ worked but not /Users//, it does now. Fixes #44 --- src/sambal/resources/container.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/sambal/resources/container.py b/src/sambal/resources/container.py index 3ebade9..ea5d524 100644 --- a/src/sambal/resources/container.py +++ b/src/sambal/resources/container.py @@ -18,8 +18,7 @@ def __init__(self, request, container): polymorphic=True, ) - self["children"] = [] for obj in queryset: if obj: resource_class = self.resource_for_model(obj) - self["children"].append(resource_class(request, obj)) + self[obj.name] = resource_class(request, obj)