• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python models.Setting类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: set_custom_theme

def set_custom_theme(player, theme):
    from wouso.utils import get_themes
    from wouso.core.config.models import Setting
    if theme in get_themes():
        Setting.get('theme_user_%d' % player.id).set_value(theme)
        return True
    return False
开发者ID:AndreiRO,项目名称:wouso,代码行数:7,代码来源:__init__.py


示例2: chat_scripts

def chat_scripts():
    """
    Dump the chat scris
    :return:
    """
    if settings.CHAT_ENABLED and not Setting.get('disable-Chat').get_value():
        return render_to_string('chat/setup.html', {'chat_host': Setting.get('chat_host').get_value(),
                                                    'chat_port': Setting.get('chat_port').get_value(),
                                                    'basepath': settings.FORCE_SCRIPT_NAME,
        })
    return ''
开发者ID:AndreiRO,项目名称:wouso,代码行数:11,代码来源:chat.py


示例3: coin_top_settings

    def coin_top_settings(cls):
        """
        Return a list of coin names for which we calculate the top

        Example: ['gold', 'karma']
        """
        return [c for c in Setting.get('top-coins').get_value().split(',') if c] or []
开发者ID:ArmandNM,项目名称:wouso,代码行数:7,代码来源:models.py


示例4: read

 def read(self, request):
     api = {
         'api_version': API_VERSION,
         'title': Setting.get('title').get_value(),
         'authenticated': request.user.is_authenticated()
     }
     return api
开发者ID:ArmandNM,项目名称:wouso,代码行数:7,代码来源:handlers.py


示例5: render_zone

def render_zone(context, zone, glue):
    """
    :return: HTML for the sidebar
    """
    s = get_library(zone)
    order = [k for k in Setting.get('%s-order' % zone).get_value().split(',') if k]
    if not order:
        order = s.get_blocks()
    return glue.join([s.get_block(block, context) for block in order])
开发者ID:AndreiRO,项目名称:wouso,代码行数:9,代码来源:ui.py


示例6: handle

    def handle(self, *args, **options):
        self.stdout.write('Starting at: %s\n' % datetime.now())

        # Now handle other apps
        from wouso.interface import get_apps
        apps = get_apps()

        for a in apps:
            self.stdout.write('%s ...\n' % a.name())
            a.management_task(stdout=self.stdout)

        # Now handle games
        for g in get_games():
            if g.management_task:
                self.stdout.write('%s ...\n' % g.name())
                g.management_task(stdout=self.stdout)

        now = datetime.now()
        Setting.get('wousocron_lastrun').set_value('%s' % now)
        self.stdout.write('Finished at: %s\n' % now)
开发者ID:ciprianf,项目名称:wouso,代码行数:20,代码来源:wousocron.py


示例7: get_theme

def get_theme():
    """
     Return the current theme
    """
    global _theme

    if _theme is None:
        from wouso.core.config.models import Setting
        return Setting.get('theme').value

    return _theme
开发者ID:cvicentiu,项目名称:wouso,代码行数:11,代码来源:__init__.py


示例8: setup_user_groups

def setup_user_groups():
    # Assistants group, 'Staff'
    staff = Group.objects.get_or_create(name='Staff')[0]
    cpanel_perm = Permission.objects.get(codename='change_setting')
    staff.permissions.add(cpanel_perm)

    # Default entry race, 'Unaffiliated'
    unaffiliated = Race.objects.get_or_create(name='Unaffiliated')[0]
    unaffiliated.can_play = False
    unaffiliated.save()
    default_race = Setting.get('default_race')
    default_race.set_value(str(unaffiliated.pk))
开发者ID:ArmandNM,项目名称:wouso,代码行数:12,代码来源:utils.py


示例9: get_context_data

    def get_context_data(self, **kwargs):
        from wouso.games.quest.models import Quest, QuestGame
        from django import get_version
        from wouso.settings import WOUSO_VERSION, DATABASES
        from wouso.core.config.models import Setting

        database = DATABASES['default'].copy()
        database_engine = database['ENGINE'].split('.')[-1]
        database_name = database['NAME']

        future_questions = Schedule.objects.filter(
            day__gte=datetime.datetime.now())
        nr_future_questions = len(future_questions)
        questions = Question.objects.all()
        nr_questions = len(questions)
        active_quest = QuestGame().get_current()
        total_quests = Quest.objects.all().count()

        # artifacts
        artifact_groups = ArtifactGroup.objects.all()

        # admins
        staff_group, new = auth.Group.objects.get_or_create(name='Staff')

        # wousocron last_run
        last_run = Setting.get('wousocron_lastrun').get_value()
        if last_run == "":
            last_run = "wousocron was never run"

        # online members
        oldest = datetime.datetime.now() - datetime.timedelta(minutes=10)
        online_last10 = Player.objects.filter(last_seen__gte=oldest).order_by(
            '-last_seen')

        # number of players which can play
        cp_number = Player.objects.filter(race__can_play=True).count()

        context = super(StatusView, self).get_context_data(**kwargs)
        context.update({'nr_future_questions': nr_future_questions,
                        'nr_questions': nr_questions,
                        'active_quest': active_quest,
                        'total_quests': total_quests,
                        'artifact_groups': artifact_groups,
                        'django_version': get_version(),
                        'wouso_version': WOUSO_VERSION,
                        'database_engine': database_engine,
                        'database_name': database_name,
                        'staff': staff_group,
                        'last_run': last_run,
                        'online_users': online_last10,
                        'cp_number': cp_number})
        return context
开发者ID:TobyWanKenobi,项目名称:wouso,代码行数:52,代码来源:views.py


示例10: render_header

def render_header(context):
    s = get_library('header')
    order = [k for k in Setting.get('header-order').get_value().split(',') if k]
    if not order:
        order = s.get_blocks()
    content = ''
    for block in order:
        data = s.get_block(block, context)
        if not data:
            continue
        content += '<span id="head-%s"><a href="%s">%s' % (block, data.get('link', ''), data.get('text', ''))
        if data.get('count', 0):
            content += '<sup class="unread-count">%s</sup>' % data.get('count')
        content += '</a></span> '
    return content
开发者ID:AndreiRO,项目名称:wouso,代码行数:15,代码来源:ui.py


示例11: dashboard

def dashboard(request):
    from wouso.games.quest.models import Quest, QuestGame
    from django import get_version
    from wouso.settings import WOUSO_VERSION
    from wouso.core.config.models import Setting

    future_questions = Schedule.objects.filter(day__gte=datetime.datetime.now())
    nr_future_questions = len(future_questions)

    questions = Question.objects.all()
    nr_questions = len(questions)
    active_quest = QuestGame().get_current()
    total_quests = Quest.objects.all().count()

    # artifacts
    artifact_groups = ArtifactGroup.objects.all()

    # admins
    staff_group, new = auth.Group.objects.get_or_create(name='Staff')

    # wousocron last_run
    last_run = Setting.get('wousocron_lastrun').get_value()
    if last_run == "":
        last_run="wousocron was never run"

    # online members
    oldest = datetime.datetime.now() - datetime.timedelta(minutes = 10)
    online_last10 = Player.objects.filter(last_seen__gte=oldest).order_by('-last_seen')

    # number of players which can play
    cp_number = Player.objects.filter(race__can_play=True).count()

    return render_to_response('cpanel/index.html',
                              {'nr_future_questions' : nr_future_questions,
                               'nr_questions' : nr_questions,
                               'active_quest': active_quest,
                               'total_quests': total_quests,
                               'module': 'home',
                               'artifact_groups': artifact_groups,
                               'django_version': get_version(),
                               'wouso_version': WOUSO_VERSION,
                               'staff': staff_group,
                               'last_run': last_run,
                               'online_users': online_last10,
                               'cp_number': cp_number,
                               },
                              context_instance=RequestContext(request))
开发者ID:TomyRO,项目名称:wouso,代码行数:47,代码来源:views.py


示例12: render_zone

def render_zone(context, zone, glue):
    """
    :return: HTML for the sidebar
    """
    s = get_library(zone)
    order = [k for k in Setting.get('%s-order' % zone).get_value().split(',') if k]
    if not order:
        order = s.get_blocks()

    # Do not print blocks with empty contents.
    non_empty_block_contents = []
    for block in order:
        content = s.get_block(block, context)
        if content and not content.isspace():
            non_empty_block_contents.append(content)

    return glue.join(non_empty_block_contents)
开发者ID:ArmandNM,项目名称:wouso,代码行数:17,代码来源:ui.py


示例13: dashboard

def dashboard(request):
    from wouso.games.quest.models import Quest, QuestGame
    from django import get_version
    from wouso.settings import WOUSO_VERSION
    from wouso.core.config.models import Setting

    future_questions = Schedule.objects.filter(day__gte=datetime.datetime.now())
    nr_future_questions = len(future_questions)

    questions = Question.objects.all()
    nr_questions = len(questions)
    active_quest = QuestGame().get_current()
    total_quests = Quest.objects.all().count()

    # artifacts
    artifact_groups = ArtifactGroup.objects.all()

    # admins
    staff_group, new = auth.Group.objects.get_or_create(name='Staff')

    # wousocron last_run
    last_run = Setting.get('wousocron_lastrun').get_value()

    return render_to_response('cpanel/index.html',
                              {'nr_future_questions' : nr_future_questions,
                               'nr_questions' : nr_questions,
                               'active_quest': active_quest,
                               'total_quests': total_quests,
                               'module': 'home',
                               'artifact_groups': artifact_groups,
                               'django_version': get_version(),
                               'wouso_version': WOUSO_VERSION,
                               'staff': staff_group,
                               'last_run': last_run,
                               },
                              context_instance=RequestContext(request))
开发者ID:taygun,项目名称:wouso,代码行数:36,代码来源:views.py


示例14: post

 def post(self, request):
     data = request.POST['display']
     blocks = ','.join([b.strip() for b in data.split(',') if b.strip()])
     Setting.get('sidebar-order').set_value(blocks)
     return redirect('cpanel_display')
开发者ID:TobyWanKenobi,项目名称:wouso,代码行数:5,代码来源:views.py


示例15: get_theme_dir

 def get_theme_dir(self):
     """ Note (AE): I'm unhappy with this approach, since a Setting.get
     call is done for every request. THIS must be cached somehow
     """
     theme = Setting.get('theme').value
     return os.path.join(settings.THEMES_ROOT, theme, 'templates')
开发者ID:LucianU,项目名称:wouso,代码行数:6,代码来源:loaders.py


示例16: get_custom_theme

def get_custom_theme(player):
    from wouso.core.config.models import Setting
    return Setting.get('theme_user_%d' % player.id).get_value()
开发者ID:AndreiRO,项目名称:wouso,代码行数:3,代码来源:__init__.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python game.get_games函数代码示例发布时间:2022-05-26
下一篇:
Python models.BoolSetting类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap