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

Adding checksums to file attributes #233

Merged
merged 1 commit into from
May 23, 2019
Merged
Show file tree
Hide file tree
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: 3 additions & 2 deletions pulp_file/app/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from rest_framework import serializers

from pulpcore.plugin.serializers import (
ContentChecksumSerializer,
DetailRelatedField,
PublicationDistributionSerializer,
PublicationSerializer,
Expand All @@ -14,7 +15,7 @@
from .models import FileContent, FileDistribution, FileRemote, FilePublication


class FileContentSerializer(SingleArtifactContentSerializer):
class FileContentSerializer(SingleArtifactContentSerializer, ContentChecksumSerializer):
"""
Serializer for File Content.
"""
Expand Down Expand Up @@ -45,7 +46,7 @@ def validate(self, data):
class Meta:
fields = tuple(
set(SingleArtifactContentSerializer.Meta.fields) - {'_relative_path'}
) + ('relative_path',)
) + ContentChecksumSerializer.Meta.fields + ('relative_path',)
model = FileContent


Expand Down
2 changes: 1 addition & 1 deletion pulp_file/app/viewsets.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class FileContentViewSet(ContentViewSet):
"""

endpoint_name = 'files'
queryset = FileContent.objects.all()
queryset = FileContent.objects.prefetch_related("_artifacts")
serializer_class = FileContentSerializer
filterset_class = FileContentFilter

Expand Down