功能变化: 初始化系统菜单优化
parent
3d662e0f0e
commit
f870442f6d
|
@ -365,14 +365,11 @@
|
||||||
"method": 3
|
"method": 3
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
|
||||||
],
|
|
||||||
"menu_button": []
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "常规配置",
|
"name": "常规配置",
|
||||||
"icon": "cogs",
|
"icon": "cogs",
|
||||||
"sort": 2,
|
"sort": 9,
|
||||||
"is_link": false,
|
"is_link": false,
|
||||||
"is_catalog": true,
|
"is_catalog": true,
|
||||||
"web_path": "",
|
"web_path": "",
|
||||||
|
@ -571,7 +568,7 @@
|
||||||
{
|
{
|
||||||
"name": "日志管理",
|
"name": "日志管理",
|
||||||
"icon": "book",
|
"icon": "book",
|
||||||
"sort": 3,
|
"sort": 10,
|
||||||
"is_link": false,
|
"is_link": false,
|
||||||
"is_catalog": true,
|
"is_catalog": true,
|
||||||
"web_path": "",
|
"web_path": "",
|
||||||
|
@ -658,6 +655,9 @@
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"menu_button": []
|
"menu_button": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"menu_button": []
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "DVAdmin官网",
|
"name": "DVAdmin官网",
|
||||||
|
@ -668,7 +668,7 @@
|
||||||
"web_path": "https://django-vue-admin.com",
|
"web_path": "https://django-vue-admin.com",
|
||||||
"component": "",
|
"component": "",
|
||||||
"component_name": "",
|
"component_name": "",
|
||||||
"status": true,
|
"status": false,
|
||||||
"cache": false,
|
"cache": false,
|
||||||
"visible": true,
|
"visible": true,
|
||||||
"parent": null,
|
"parent": null,
|
||||||
|
|
|
@ -160,7 +160,7 @@ class Dept(CoreModel):
|
||||||
class Menu(CoreModel):
|
class Menu(CoreModel):
|
||||||
parent = models.ForeignKey(
|
parent = models.ForeignKey(
|
||||||
to="Menu",
|
to="Menu",
|
||||||
on_delete=models.PROTECT,
|
on_delete=models.CASCADE,
|
||||||
verbose_name="上级菜单",
|
verbose_name="上级菜单",
|
||||||
null=True,
|
null=True,
|
||||||
blank=True,
|
blank=True,
|
||||||
|
|
|
@ -6,7 +6,8 @@ from django.apps import apps
|
||||||
from rest_framework import request
|
from rest_framework import request
|
||||||
|
|
||||||
from application import settings
|
from application import settings
|
||||||
from dvadmin.system.models import Users
|
from application.dispatch import is_tenants_mode
|
||||||
|
from dvadmin.system.models import Users, Menu
|
||||||
|
|
||||||
|
|
||||||
class CoreInitialize:
|
class CoreInitialize:
|
||||||
|
@ -30,6 +31,9 @@ class CoreInitialize:
|
||||||
|
|
||||||
def init_base(self, Serializer, unique_fields=None):
|
def init_base(self, Serializer, unique_fields=None):
|
||||||
model = Serializer.Meta.model
|
model = Serializer.Meta.model
|
||||||
|
if is_tenants_mode() and model._meta.model_name == 'menu':
|
||||||
|
# 超级租户模式下,取消初始化菜单
|
||||||
|
return
|
||||||
path_file = os.path.join(apps.get_app_config(self.app.split('.')[-1]).path, 'fixtures',
|
path_file = os.path.join(apps.get_app_config(self.app.split('.')[-1]).path, 'fixtures',
|
||||||
f'init_{Serializer.Meta.model._meta.model_name}.json')
|
f'init_{Serializer.Meta.model._meta.model_name}.json')
|
||||||
if not os.path.isfile(path_file):
|
if not os.path.isfile(path_file):
|
||||||
|
|
Loading…
Reference in New Issue