MrDoc/app_admin/context_processors.py

18 lines
540 B
Python
Raw Normal View History

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
from django.conf import settings
2019-12-01 20:44:16 +08:00
# 系统设置 - 上下文变量
def sys_setting(request):
setting_dict = dict()
# 设置网站版本
setting_dict['mrdoc_version'] = settings.VERSIONS
2019-12-01 20:44:16 +08:00
# 获取系统设置状态
datas = SysSetting.objects.filter(types="basic")
for data in datas:
setting_dict[data.name] = data.value
return setting_dict