diff options
author | Matthew Lemon <y@yulqen.org> | 2024-12-03 14:32:40 +0000 |
---|---|---|
committer | Matthew Lemon <y@yulqen.org> | 2024-12-03 14:32:40 +0000 |
commit | 38f7a88a15f1278df6a44242e2e22814914beddb (patch) | |
tree | 48c466189f00ef2762a584667b3e5fa15136005e | |
parent | eb0643038758c3cac06c2df85a623ddd9474a158 (diff) |
Sorted imports
-rw-r--r-- | alphabetlearning/payments/views.py | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/alphabetlearning/payments/views.py b/alphabetlearning/payments/views.py index 07a0177..d0172d0 100644 --- a/alphabetlearning/payments/views.py +++ b/alphabetlearning/payments/views.py @@ -1,20 +1,26 @@ +import stripe from django.conf import settings from django.contrib.auth.decorators import login_required from django.core.mail import send_mail -from django.http import HttpResponse, HttpResponseBadRequest -from django.shortcuts import get_object_or_404, render, redirect -from django.urls import reverse, reverse_lazy +from django.http import HttpResponse +from django.http import HttpResponseBadRequest +from django.shortcuts import get_object_or_404 +from django.shortcuts import redirect +from django.shortcuts import render +from django.urls import reverse +from django.urls import reverse_lazy from django.views import View from django.views.decorators.csrf import csrf_exempt -from django.views.generic import TemplateView, DeleteView +from django.views.generic import DeleteView +from django.views.generic import TemplateView from alphabetlearning.payments.models import EmailSignup from alphabetlearning.resources.models import Resource from alphabetlearning.users.models import User -from .models import CartItem, Price, Product, ShoppingCart - -import stripe +from .models import CartItem +from .models import Price +from .models import ShoppingCart # TODO get the cart integrated with Stripe # Steps to convert our Cart into something that can be used with Stripe: @@ -202,12 +208,12 @@ def stripe_webhook(request): class DeleteCartItem(DeleteView): model = CartItem success_url = reverse_lazy("payments:cart_detail") - + # delete the cart item if there is more than one # delete the item and the cart itself if it is the last thing in the cart def post(self, request, *args, **kwargs): cart_items = request.user.shoppingcart.items.all() - if len(cart_items) > 1: + if len(cart_items) > 1: return self.delete(request, *args, **kwargs) else: request.user.shoppingcart.delete() @@ -215,6 +221,3 @@ class DeleteCartItem(DeleteView): def privacy_policy(request): return render(request, 'pages/privacy_policy.html') - - - |