|
|
|
@ -1,6 +1,6 @@
@@ -1,6 +1,6 @@
|
|
|
|
|
from django.views import generic |
|
|
|
|
from django import forms |
|
|
|
|
from django.shortcuts import render_to_response, get_object_or_404 |
|
|
|
|
from django.shortcuts import render_to_response, get_object_or_404, redirect |
|
|
|
|
from django.contrib.auth.decorators import login_required |
|
|
|
|
from django.template import RequestContext |
|
|
|
|
from django.core import paginator |
|
|
|
@ -80,18 +80,25 @@ def buy(request, product_id, confirm=False):
@@ -80,18 +80,25 @@ def buy(request, product_id, confirm=False):
|
|
|
|
|
product = get_object_or_404(Product, id=product_id) |
|
|
|
|
|
|
|
|
|
if confirm: |
|
|
|
|
context = RequestContext(request) |
|
|
|
|
if request.user.account.buy_product(product, 1): |
|
|
|
|
return render_to_response('cash/buy_thanks.html', |
|
|
|
|
context_instance=context) |
|
|
|
|
return redirect('buy_thanks') |
|
|
|
|
else: |
|
|
|
|
return render_to_response('cash/buy_error.html', |
|
|
|
|
context_instance=context) |
|
|
|
|
return redirect('buy_error') |
|
|
|
|
else: |
|
|
|
|
context = RequestContext(request, {'product': product}) |
|
|
|
|
return render_to_response('cash/buy_confirm.html', |
|
|
|
|
context_instance=context) |
|
|
|
|
|
|
|
|
|
@login_required |
|
|
|
|
def buy_thanks(request): |
|
|
|
|
context = RequestContext(request) |
|
|
|
|
return render_to_response('cash/buy_thanks.html', context_instance=context) |
|
|
|
|
|
|
|
|
|
@login_required |
|
|
|
|
def buy_error(request): |
|
|
|
|
context = RequestContext(request) |
|
|
|
|
return render_to_response('cash/buy_error.html', context_instance=context) |
|
|
|
|
|
|
|
|
|
class UserSettingsForm(forms.Form): |
|
|
|
|
daily_digest = forms.BooleanField(required=False, |
|
|
|
|
label=ugettext_lazy('daily digest')) |
|
|
|
|