Skip to content

Commit

Permalink
add tree root to the url serializer
Browse files Browse the repository at this point in the history
  • Loading branch information
CarsonDavis committed Mar 1, 2024
1 parent 76abc6d commit 681e78d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions sde_collections/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -101,6 +102,7 @@ class Meta:
"document_type",
"hash",
"file_extension",
"tree_root",
)

def get_document_type(self, obj):
Expand All @@ -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)
Expand Down

0 comments on commit 681e78d

Please sign in to comment.