Skip to content

Commit

Permalink
added file extension field to the serilaizer
Browse files Browse the repository at this point in the history
  • Loading branch information
bishwaspraveen committed Feb 22, 2024
1 parent cbaebbc commit 4e41e9d
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 @@ -91,6 +91,7 @@ class Meta:
class CandidateURLAPISerializer(serializers.ModelSerializer):
document_type = serializers.SerializerMethodField()
title = serializers.SerializerMethodField()
file_extension = serializers.SerializerMethodField()

class Meta:
model = CandidateURL
Expand All @@ -99,6 +100,7 @@ class Meta:
"title",
"document_type",
"hash",
"file_extension",
)

def get_document_type(self, obj):
Expand All @@ -112,6 +114,9 @@ def get_document_type(self, obj):
def get_title(self, obj):
return obj.generated_title if obj.generated_title else obj.scraped_title

def get_file_extension(self, obj):
return obj.fileext


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 4e41e9d

Please sign in to comment.