From 82667216f279e0f1280a8b4e5069bce6a6ddc90c Mon Sep 17 00:00:00 2001 From: Egor fureunoir Gorbunov Date: Sun, 11 May 2025 22:43:38 +0300 Subject: [PATCH] Features: None; Fixes: 1) Prevent error by adding user check when processing non-PENDING orders; 2) Remove redundant status assignment and save for CREATED orders; 3) Add missing error handler for POST requests in settings; Extra: None; --- core/signals.py | 4 +--- evibes/settings/base.py | 1 + 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/core/signals.py b/core/signals.py index 40477a1a..e239e363 100644 --- a/core/signals.py +++ b/core/signals.py @@ -62,7 +62,7 @@ def create_promocode_on_user_referring(instance, created, **kwargs): @receiver(post_save, sender=Order) def process_order_changes(instance, created, **kwargs): if not created: - if instance.status != "PENDING": + if instance.status != "PENDING" and instance.user: pending_orders = Order.objects.filter(user=instance.user, status="PENDING") if not pending_orders.exists(): @@ -80,8 +80,6 @@ def process_order_changes(instance, created, **kwargs): if instance.status == "CREATED": if not instance.is_whole_digital: send_order_created_email.delay(instance.uuid) - instance.status = "DELIVERING" - instance.save() for order_product in instance.order_products.filter(status="DELIVERING"): if not order_product.product.is_digital: continue diff --git a/evibes/settings/base.py b/evibes/settings/base.py index cbfb6255..d2516a6a 100644 --- a/evibes/settings/base.py +++ b/evibes/settings/base.py @@ -296,6 +296,7 @@ if getenv("SENTRY_DSN"): debug=False, ignore_errors=[ "flower.views.error.NotFoundErrorHandler.get", + "flower.views.error.NotFoundErrorHandler.post", "django.http.response.Http404", "billiard.exceptions.SoftTimeLimitExceeded", "core.models.Product.DoesNotExist",