Beispiel #1
0
def upgrade_premium(request):
    user_id = request.REQUEST.get('user_id')
    user = User.objects.get(pk=user_id)
    
    gift = MGiftCode.add(gifting_user_id=User.objects.get(username='******').pk, 
                         receiving_user_id=user.pk)
    MRedeemedCode.redeem(user, gift.gift_code)
    
    return {'code': user.profile.is_premium}
Beispiel #2
0
def upgrade_premium(request):
    user_id = request.REQUEST.get('user_id')
    user = User.objects.get(pk=user_id)
    
    gift = MGiftCode.add(gifting_user_id=User.objects.get(username='******').pk, 
                         receiving_user_id=user.pk)
    MRedeemedCode.redeem(user, gift.gift_code)
    
    return {'code': user.profile.is_premium}
Beispiel #3
0
def redeem_code(request):
    code = request.GET.get('code', None)
    form = RedeemCodeForm(initial={'gift_code': code})

    if request.method == "POST":
        form = RedeemCodeForm(data=request.POST)
        if form.is_valid():
            gift_code = request.POST['gift_code']
            MRedeemedCode.redeem(user=request.user, gift_code=gift_code)
            return render(request, 'reader/paypal_return.xhtml')

    return render(request, 'accounts/redeem_code.html', {
        'form': form,
        'code': request.POST.get('code', ""),
        'next': request.POST.get('next', "")
    })
Beispiel #4
0
def redeem_code(request):
    code = request.GET.get('code', None)
    form = RedeemCodeForm(initial={'gift_code': code})

    if request.method == "POST":
        form = RedeemCodeForm(data=request.POST)
        if form.is_valid():
            gift_code = request.POST['gift_code']
            MRedeemedCode.redeem(user=request.user, gift_code=gift_code)
            return render_to_response('reader/paypal_return.xhtml', 
                                      {}, context_instance=RequestContext(request))

    return render_to_response('accounts/redeem_code.html', {
        'form': form,
        'code': request.REQUEST.get('code', ""),
        'next': request.REQUEST.get('next', "")
    }, context_instance=RequestContext(request))
Beispiel #5
0
def redeem_code(request):
    code = request.GET.get('code', None)
    form = RedeemCodeForm(initial={'gift_code': code})

    if request.method == "POST":
        form = RedeemCodeForm(data=request.POST)
        if form.is_valid():
            gift_code = request.POST['gift_code']
            MRedeemedCode.redeem(user=request.user, gift_code=gift_code)
            return render_to_response('reader/paypal_return.xhtml', 
                                      {}, context_instance=RequestContext(request))

    return render_to_response('accounts/redeem_code.html', {
        'form': form,
        'code': request.REQUEST.get('code', ""),
        'next': request.REQUEST.get('next', "")
    }, context_instance=RequestContext(request))