当前位置: 首页>>代码示例>>Python>>正文


Python Setting.get_setting方法代码示例

本文整理汇总了Python中models.Setting.get_setting方法的典型用法代码示例。如果您正苦于以下问题:Python Setting.get_setting方法的具体用法?Python Setting.get_setting怎么用?Python Setting.get_setting使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.Setting的用法示例。


在下文中一共展示了Setting.get_setting方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from models import Setting [as 别名]
# 或者: from models.Setting import get_setting [as 别名]
    def __init__(self, *args, **kwargs):
        """
        Overrides the __init__ to fill the form initial data
        from database
        """
        user = kwargs.get('user', None)

        initial = {}
        for field_name, obj in self.base_fields.items():
            if user:
                initial[field_name] = Setting.get_setting(user, field_name)
            else:
                initial[field_name] = AdminSetting.get_setting(field_name)

        kwargs['initial'] = initial
        super(BaseSettingForm, self).__init__(*args, **kwargs)
        self.user = user
开发者ID:ekaputra07,项目名称:bokerface,代码行数:19,代码来源:forms.py

示例2: initialize

# 需要导入模块: from models import Setting [as 别名]
# 或者: from models.Setting import get_setting [as 别名]
    def initialize(self, request, response):
        """initial webapp.RequestHandler"""
        webapp.RequestHandler.initialize(self, request, response)

        if not self.request.path.endswith('/'):
            return self.redirect(self.request.path + "/", True)
        self.setting = Setting.get_setting()
        self.template_value = {'setting' : self.setting}

        # check cookies and find user
        cookies = parse_cookie(self.request.headers.get("Cookie", ""))
        self.session_key = cookies.get('bitsable-session-key', None)

        self.user = None
        if self.session_key is not None and len(self.session_key) == 40:
            logging.info("session_key:%s" % self.session_key)
            self.user = Session.get_user_by_session(self.session_key)
        self.template_value['user'] = self.user
开发者ID:sthtodo,项目名称:bitsbang,代码行数:20,代码来源:main.py

示例3: user_setting_value

# 需要导入模块: from models import Setting [as 别名]
# 或者: from models.Setting import get_setting [as 别名]
def user_setting_value(name):
    """Print user setting value to template"""
    return Setting.get_setting(user, name) 
开发者ID:ekaputra07,项目名称:bokerface,代码行数:5,代码来源:templatetags.py


注:本文中的models.Setting.get_setting方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。