From 6dc0168836cdfc98423e5c008ebf8033281446b0 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Fri, 5 Sep 2014 22:29:41 +0200 Subject: [PATCH] Disable not partial updates on attachment resources. PUT request does not supports multipart request, but attached_file is required. Because of this condition, put requests for attachments resources are not possible, for it, them are disabled explicitly. --- taiga/projects/attachments/api.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/taiga/projects/attachments/api.py b/taiga/projects/attachments/api.py index 987a721c..e1195e2f 100644 --- a/taiga/projects/attachments/api.py +++ b/taiga/projects/attachments/api.py @@ -34,7 +34,6 @@ from taiga.users.models import User from taiga.projects.notifications import WatchedResourceMixin from taiga.projects.history import HistoryResourceMixin - from . import permissions from . import serializers from . import models @@ -47,6 +46,12 @@ class BaseAttachmentViewSet(HistoryResourceMixin, WatchedResourceMixin, ModelCru content_type = None + def update(self, *args, **kwargs): + partial = kwargs.get("partial", False) + if not partial: + raise exc.NotSupported("Non partial updates not supported") + return super().update(*args, **kwargs) + def get_content_type(self): app_name, model = self.content_type.split(".", 1) return get_object_or_404(ContentType, app_label=app_name, model=model)