Skip to content
This repository has been archived by the owner on Jul 25, 2024. It is now read-only.

Commit

Permalink
api/rest.py,core/models.py: WIP support for attachement access
Browse files Browse the repository at this point in the history
WIP draft of support for accessing attachments.
  • Loading branch information
katieworton committed Oct 30, 2023
1 parent b7adc79 commit 2fcf44c
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions squad/api/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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)

0 comments on commit 2fcf44c

Please sign in to comment.