Merge remote-tracking branch 'origin/v2.x' into v2.x
commit
7efc55091b
|
@ -48,6 +48,16 @@ def _get_all_system_config():
|
|||
value = system_config.get("value", "")
|
||||
if value and system_config.get("form_item_type") == 7:
|
||||
value = value[0].get("url")
|
||||
if value and system_config.get("form_item_type") == 11:
|
||||
new_value = []
|
||||
for ele in value:
|
||||
new_value.append({
|
||||
"key": ele.get('key'),
|
||||
"title": ele.get('title'),
|
||||
"value": ele.get('value'),
|
||||
})
|
||||
new_value.sort(key=lambda s: s["key"])
|
||||
value = new_value
|
||||
data[f"{system_config.get('parent__key')}.{system_config.get('key')}"] = value
|
||||
return data
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ from rest_framework import serializers
|
|||
from rest_framework.decorators import action
|
||||
|
||||
from dvadmin.system.models import Menu, MenuButton
|
||||
from dvadmin.system.views.menu_button import MenuButtonSerializer
|
||||
from dvadmin.system.views.menu_button import MenuButtonInitSerializer
|
||||
from dvadmin.utils.json_response import SuccessResponse
|
||||
from dvadmin.utils.serializers import CustomModelSerializer
|
||||
from dvadmin.utils.viewset import CustomModelViewSet
|
||||
|
@ -106,7 +106,7 @@ class MenuInitSerializer(CustomModelSerializer):
|
|||
"value": menu_button_data['value']
|
||||
}
|
||||
instance_obj = MenuButton.objects.filter(**filter_data).first()
|
||||
serializer = MenuButtonSerializer(instance_obj, data=menu_button_data, request=self.request)
|
||||
serializer = MenuButtonInitSerializer(instance_obj, data=menu_button_data, request=self.request)
|
||||
serializer.is_valid(raise_exception=True)
|
||||
serializer.save()
|
||||
return instance
|
||||
|
|
|
@ -18,7 +18,18 @@ class MenuButtonSerializer(CustomModelSerializer):
|
|||
|
||||
class Meta:
|
||||
model = MenuButton
|
||||
fields = ['id','name','value','api','method']
|
||||
fields = ['id', 'name', 'value', 'api', 'method']
|
||||
read_only_fields = ["id"]
|
||||
|
||||
|
||||
class MenuButtonInitSerializer(CustomModelSerializer):
|
||||
"""
|
||||
初始化菜单按钮-序列化器
|
||||
"""
|
||||
|
||||
class Meta:
|
||||
model = MenuButton
|
||||
fields = ['id', 'name', 'value', 'api', 'method', 'menu']
|
||||
read_only_fields = ["id"]
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue