From a9bdbcf7c6415ce8ff63c47da7b8a37f002d2bd6 Mon Sep 17 00:00:00 2001 From: xinwen Date: Wed, 2 Jun 2021 19:11:08 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20metadata=20api=20view=20=E6=8A=A5?= =?UTF-8?q?=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/common/drf/metadata.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/common/drf/metadata.py b/apps/common/drf/metadata.py index 3a0e98c50..afd7389bb 100644 --- a/apps/common/drf/metadata.py +++ b/apps/common/drf/metadata.py @@ -32,7 +32,9 @@ class SimpleMetadataWithFilters(SimpleMetadata): """ actions = {} for method in self.methods & set(view.allowed_methods): - view.action = view.action_map.get(method.lower(), view.action) + if hasattr(view, 'action_map'): + view.action = view.action_map.get(method.lower(), view.action) + view.request = clone_request(request, method) try: # Test global permissions