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


Python Game.games方法代码示例

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


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

示例1: inject_outbreak_percentage

# 需要导入模块: from HVZ.main.models import Game [as 别名]
# 或者: from HVZ.main.models.Game import games [as 别名]
def inject_outbreak_percentage(request):
    try:
        latest_game = Game.games(started=True).latest()
    except Game.DoesNotExist:
        # Just return an arbitrary sane value
        return {'outbreak_percent': 96}

    players = Player.objects.filter(game=latest_game)
    humans = players.filter(team='H')

    nPlayers = players.count()

    if nPlayers > 0:
        percent = humans.count() * 100. / nPlayers
    else:
        percent = 100

    return {'outbreak_percent': min(96, percent)}
开发者ID:JoshPetrack,项目名称:claremontHvZ,代码行数:20,代码来源:context_processors.py

示例2: get_context_data

# 需要导入模块: from HVZ.main.models import Game [as 别名]
# 或者: from HVZ.main.models.Game import games [as 别名]
    def get_context_data(self, *args, **kwargs):
        context = super(LandingPage, self).get_context_data(*args, **kwargs)

        if not self.request.user.is_authenticated():
            form = PrettyAuthForm()
        else:
            form = None

        context['login_form'] = form
        context['is_landing_page'] = True
        try:
            context['latest_meals'] = (
                Meal.objects.filter(
                    eater__game=Game.games(started=True).latest(),
                ).order_by('-time')[:20])
        except Game.DoesNotExist:
            context['latest_meals'] = []

        return context
开发者ID:jhb563,项目名称:claremontHvZ,代码行数:21,代码来源:views.py

示例3: wrapper

# 需要导入模块: from HVZ.main.models import Game [as 别名]
# 或者: from HVZ.main.models.Game import games [as 别名]
 def wrapper(*args, **kwargs):
     if not Game.games(finished=False).exists():
         raise NoUnfinishedGames
     return view_func(*args, **kwargs)
开发者ID:Mongoose1021,项目名称:claremontHvZ,代码行数:6,代码来源:decorators.py

示例4: wrapper

# 需要导入模块: from HVZ.main.models import Game [as 别名]
# 或者: from HVZ.main.models.Game import games [as 别名]
 def wrapper(*args, **kwargs):
     if not Game.games(started=True, finished=False).exists():
         raise NoActiveGame
     return view_func(*args, **kwargs)
开发者ID:JoshPetrack,项目名称:claremontHvZ,代码行数:6,代码来源:decorators.py


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