mirror of https://github.com/jumpserver/jumpserver
fix: 修复获取 Metadata 时,获取的总是 action 为 metadata
parent
4ef3b2630a
commit
a809eac2b8
|
@ -18,7 +18,7 @@ from rest_framework.request import clone_request
|
||||||
class SimpleMetadataWithFilters(SimpleMetadata):
|
class SimpleMetadataWithFilters(SimpleMetadata):
|
||||||
"""Override SimpleMetadata, adding info about filters"""
|
"""Override SimpleMetadata, adding info about filters"""
|
||||||
|
|
||||||
methods = {"PUT", "POST", "GET"}
|
methods = {"PUT", "POST", "GET", "PATCH"}
|
||||||
attrs = [
|
attrs = [
|
||||||
'read_only', 'label', 'help_text',
|
'read_only', 'label', 'help_text',
|
||||||
'min_length', 'max_length',
|
'min_length', 'max_length',
|
||||||
|
@ -32,6 +32,7 @@ class SimpleMetadataWithFilters(SimpleMetadata):
|
||||||
"""
|
"""
|
||||||
actions = {}
|
actions = {}
|
||||||
for method in self.methods & set(view.allowed_methods):
|
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)
|
view.request = clone_request(request, method)
|
||||||
try:
|
try:
|
||||||
# Test global permissions
|
# Test global permissions
|
||||||
|
|
Loading…
Reference in New Issue