예제 #1
0
def watch_game(request, match_id):
    _is_mobile = is_mobile(request)
    streamable_game = StreamableMatch.objects.filter(match__id=match_id).first()
    links = []
    if streamable_game:
        links = Link.objects.get_links(streamable_game.scanned_match.id)
    match = Match.objects.get(id=match_id)
    display_name = match.display_name()
    home_team = {
        "team": team_info(match.home_team.id),
        "lineup": lineup_info(match.id, home=True),
    }
    away_team = {
        "team": team_info(match.away_team.id),
        "lineup": lineup_info(match.id, home=False),
    }
    AceStreamFormSet = formset_factory(AceStreamForm)
    add_stream_formset = AceStreamFormSet()
    return render(request, 'games/templates/watch_game.html',
                  {"data": {
                      "is_mobile_tablet": _is_mobile,
                      "links": links,
                      "display_name": display_name,
                      "match": match,
                      "home_team": home_team,
                      "away_team": away_team,
                      "add_stream_formset": add_stream_formset,
                  }})
예제 #2
0
파일: views.py 프로젝트: rubythonode/bbgo
def open_vault(request, category='all'):
    """Open vault"""
    if not check_seal(request):
        return redirect('vaults:new_key')

    expired, expiry = key_expired(request)
    if expired:
        return check_key(request)

    if category == 'all':
        q = Q(user=request.user)
    else:
        q = Q(user=request.user) & Q(category__iexact=category)

    vaults = Vault.objects.filter(q).order_by('category', 'order')
    mobile = is_mobile(request)

    return render(
        request,
        "vaults/show_vault.html",
        {
            'vaults': vaults,
            'category': category,
            'expiry': expiry,
            'mobile': mobile,
        }
    )
예제 #3
0
def league_matches(request, league="PL"):
    _is_mobile = is_mobile(request)
    games = Match.objects.filter(league__code=league).order_by('match_day', 'match_date_time')
    try:
        league = League.objects.get(code=league)
    except League.DoesNotExist:
        league = League.objects.filter(code=league).first()

    return render(request, 'games/templates/league_matches.html',
                  {"data": {
                      "is_mobile_tablet": is_mobile,
                      "matches": games,
                      "league": league,
                  }})
예제 #4
0
파일: views.py 프로젝트: zenpassvpn/bbgo
def show_recipes(request, category=''):
    """Show recipes"""
    categories = Category.objects.order_by('order')
    if categories.count() == 0:
        return redirect('recipes:instruction')

    if category:
        q = Q(category__id__iexact=category)
    else:
        q = Q()

    recipes = Recipe.objects.filter(q).order_by('category__order', 'order')
    mobile = is_mobile(request)
    if category:
        category = int(category)

    return render(
        request, "recipes/show_recipes.html", {
            'categories': categories,
            'recipes': recipes,
            'category': category,
            'mobile': mobile,
        })