this code is no longer needed, the mixin checks if the order is paid
This commit is contained in:
parent
f06a8c76c3
commit
01779363d5
|
@ -39,6 +39,7 @@ class EnsureUserOwnsOrderMixin(SingleObjectMixin):
|
||||||
request, *args, **kwargs
|
request, *args, **kwargs
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class EnsureUnpaidOrderMixin(SingleObjectMixin):
|
class EnsureUnpaidOrderMixin(SingleObjectMixin):
|
||||||
model = Order
|
model = Order
|
||||||
|
|
||||||
|
@ -51,6 +52,7 @@ class EnsureUnpaidOrderMixin(SingleObjectMixin):
|
||||||
request, *args, **kwargs
|
request, *args, **kwargs
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class ShopIndexView(ListView):
|
class ShopIndexView(ListView):
|
||||||
model = Product
|
model = Product
|
||||||
template_name = "shop_index.html"
|
template_name = "shop_index.html"
|
||||||
|
@ -205,10 +207,6 @@ class CoinifyRedirectView(LoginRequiredMixin, EnsureUserOwnsOrderMixin, EnsureUn
|
||||||
messages.error(request, 'This order is still open!')
|
messages.error(request, 'This order is still open!')
|
||||||
return HttpResponseRedirect('shop:order_detail')
|
return HttpResponseRedirect('shop:order_detail')
|
||||||
|
|
||||||
if order.paid:
|
|
||||||
messages.error(request, 'This order is already paid for!')
|
|
||||||
return HttpResponseRedirect('shop:order_detail')
|
|
||||||
|
|
||||||
if not order.products.count() > 0:
|
if not order.products.count() > 0:
|
||||||
messages.error(request, 'This order contains no products!')
|
messages.error(request, 'This order contains no products!')
|
||||||
return HttpResponseRedirect('shop:order_detail')
|
return HttpResponseRedirect('shop:order_detail')
|
||||||
|
|
Loading…
Reference in a new issue