Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add tree root to the url serializer #640

Merged
merged 1 commit into from
Mar 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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