From d4a49fcf568f5388e2caf5fa0a6501108cdc333b Mon Sep 17 00:00:00 2001 From: rizwanisready Date: Fri, 24 May 2024 21:08:36 +0530 Subject: [PATCH] existing subscription validation 6 --- manage_subscriptions/views.py | 3 +-- templates/stripe_html/index.html | 8 ++------ 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/manage_subscriptions/views.py b/manage_subscriptions/views.py index 8c11b60..383e465 100644 --- a/manage_subscriptions/views.py +++ b/manage_subscriptions/views.py @@ -429,8 +429,7 @@ def create_checkout_session(request): if has_active_principal_subscription(principal_id): print("Active principal subscription already exists.") - messages.error(request, "Active principal subscription already exists") - return redirect("manage_subscriptions:stripe") + return JsonResponse({"error-message": "Active principal subscription already exists"}, status=400) try: subscription = Subscription.objects.get(id=subscription_id) diff --git a/templates/stripe_html/index.html b/templates/stripe_html/index.html index 9d1f1c2..1914b80 100644 --- a/templates/stripe_html/index.html +++ b/templates/stripe_html/index.html @@ -52,12 +52,8 @@
-
- {% for message in messages %} - - {% endfor %} +
+