From 681e78dfde78f64c3287c73326609f6d7387bb60 Mon Sep 17 00:00:00 2001 From: Carson Davis Date: Thu, 29 Feb 2024 18:09:34 -0600 Subject: [PATCH] add tree root to the url serializer --- sde_collections/serializers.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sde_collections/serializers.py b/sde_collections/serializers.py index 5051bfd1..d4ca2490 100644 --- a/sde_collections/serializers.py +++ b/sde_collections/serializers.py @@ -92,6 +92,7 @@ class CandidateURLAPISerializer(serializers.ModelSerializer): document_type = serializers.SerializerMethodField() title = serializers.SerializerMethodField() file_extension = serializers.SerializerMethodField() + tree_root = serializers.SerializerMethodField() class Meta: model = CandidateURL @@ -101,6 +102,7 @@ class Meta: "document_type", "hash", "file_extension", + "tree_root", ) def get_document_type(self, obj): @@ -117,6 +119,9 @@ def get_title(self, obj): def get_file_extension(self, obj): return obj.fileext + def get_tree_root(self, obj): + return obj.collection.tree_root + class BasePatternSerializer(serializers.ModelSerializer): match_pattern_type_display = serializers.CharField(source="get_match_pattern_type_display", read_only=True)