2019-12-01 20:44:16 +08:00
|
|
|
|
# coding:utf-8
|
|
|
|
|
# @文件: context_processer.py
|
|
|
|
|
# @创建者:州的先生
|
|
|
|
|
# #日期:2019/11/16
|
|
|
|
|
# 博客地址:zmister.com
|
|
|
|
|
from app_admin.models import SysSetting
|
2019-12-18 21:18:45 +08:00
|
|
|
|
from django.conf import settings
|
2019-12-01 20:44:16 +08:00
|
|
|
|
|
|
|
|
|
# 系统设置 - 上下文变量
|
|
|
|
|
def sys_setting(request):
|
|
|
|
|
setting_dict = dict()
|
2019-12-18 21:18:45 +08:00
|
|
|
|
# 设置网站版本
|
|
|
|
|
setting_dict['mrdoc_version'] = settings.VERSIONS
|
2020-01-15 21:03:44 +08:00
|
|
|
|
# 设置debug状态
|
|
|
|
|
setting_dict['debug'] = settings.DEBUG
|
2019-12-01 20:44:16 +08:00
|
|
|
|
# 获取系统设置状态
|
2020-09-26 21:27:06 +08:00
|
|
|
|
datas = SysSetting.objects.filter(types__in=["basic","doc"])
|
2019-12-01 20:44:16 +08:00
|
|
|
|
for data in datas:
|
|
|
|
|
setting_dict[data.name] = data.value
|
|
|
|
|
return setting_dict
|