當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。