From a809eac2b8eea9b703a5fa6a34c9bb91dc41d2a4 Mon Sep 17 00:00:00 2001 From: xinwen Date: Wed, 2 Jun 2021 17:36:47 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E8=8E=B7=E5=8F=96=20M?= =?UTF-8?q?etadata=20=E6=97=B6=EF=BC=8C=E8=8E=B7=E5=8F=96=E7=9A=84?= =?UTF-8?q?=E6=80=BB=E6=98=AF=20action=20=E4=B8=BA=20metadata?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/common/drf/metadata.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/common/drf/metadata.py b/apps/common/drf/metadata.py index cc2903d2f..3a0e98c50 100644 --- a/apps/common/drf/metadata.py +++ b/apps/common/drf/metadata.py @@ -18,7 +18,7 @@ from rest_framework.request import clone_request class SimpleMetadataWithFilters(SimpleMetadata): """Override SimpleMetadata, adding info about filters""" - methods = {"PUT", "POST", "GET"} + methods = {"PUT", "POST", "GET", "PATCH"} attrs = [ 'read_only', 'label', 'help_text', 'min_length', 'max_length', @@ -32,6 +32,7 @@ class SimpleMetadataWithFilters(SimpleMetadata): """ actions = {} for method in self.methods & set(view.allowed_methods): + view.action = view.action_map.get(method.lower(), view.action) view.request = clone_request(request, method) try: # Test global permissions