diff --git a/squad/api/rest.py b/squad/api/rest.py index da424b97..0f3fcb60 100644 --- a/squad/api/rest.py +++ b/squad/api/rest.py @@ -1308,11 +1308,19 @@ class StatusViewSet(NestedViewSetMixin, ModelViewSet): ordering = ('id',) -class AttachmentSerializer(serializers.ModelSerializer): +class AttachmentSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = Attachment - fields = ('filename', 'mimetype', 'length') + fields = '__all__' + + +class AttachmentViewSet(NestedViewSetMixin, ModelViewSet): + + queryset = Attachment.objects.all() + serializer_class = AttachmentSerializer + pagination_class = CursorPaginationWithPageSize + ordering = ('id',) class TestRunSerializer(DynamicFieldsModelSerializer, serializers.HyperlinkedModelSerializer): @@ -1901,3 +1909,4 @@ class Meta: router.register(r'metricthresholds', MetricThresholdViewSet) router.register(r'reports', DelayedReportViewSet) router.register(r'statuses', StatusViewSet) +router.register(r'attachments', AttachmentViewSet)