コード例 #1
0
ファイル: rentalplan.py プロジェクト: chrisblythe812/gamemine
def get_details(plan, request=None):
    return {
        RentalPlan.PlanA: {
            "plan": plan,
            "title": "Limited Monthly 1 Game Plan",
            "slug": "limited",
            "allowed_games": 1,
            "out_per_month": 2,
            "amount_to_charge": RentalPlan.get_start_payment_amount(plan),
            "price": RentalPlan.get_prices(plan)[1],
            "price_first_month": RentalPlan.get_prices(plan)[0],
        },
        RentalPlan.PlanB: {
            "plan": plan,
            "title": "Unlimited Monthly 2 Game Plan",
            "slug": "unlimited",
            "allowed_games": 2,
            "out_per_month": None,
            "amount_to_charge": RentalPlan.get_start_payment_amount(plan),
            "price": RentalPlan.get_prices(plan)[1],
            "price_first_month": RentalPlan.get_prices(plan)[0],
        },
    }[plan]
コード例 #2
0
ファイル: views.py プロジェクト: chrisblythe812/gamemine
def account_terms_and_details(request):
    plan = MemberRentalPlan.get_current_plan(request.user)

    if not plan or plan.status in [RentalPlanStatus.CanceledP, RentalPlanStatus.Collection]:
        return redirect('members:rent_list')

    allowed_games = '2' if plan.plan == RentalPlan.PlanA else 'unlimited'
    price_first_month, price_thereafter_months = RentalPlan.get_prices(plan.plan)
    return {
        'plan': plan,
        'plan_regular': plan.plan == RentalPlan.PlanA or plan.plan == RentalPlan.PlanB or plan.plan == RentalPlan.PlanC,
        'allowed_games': allowed_games,
        'price_first_month': price_first_month,
        'price_thereafter_months': price_thereafter_months,
        'membership_terms': RentalPlan.get_membership_terms(plan.plan) if plan else None,
    }