Features: None;
Fixes: 1) Correct type hint in `validate` method of `serializers.py`; 2) Fix incorrect use of `uuid` by converting to string in various email tasks across `signals.py` and `viewsets.py`; Extra: None;
This commit is contained in:
parent
f106013ad2
commit
8295d3f5ab
4 changed files with 6 additions and 6 deletions
|
|
@ -107,7 +107,7 @@ def process_order_changes(instance: Order, created: bool, **kwargs: dict[Any, An
|
||||||
|
|
||||||
if instance.status in ["CREATED", "PAYMENT"]:
|
if instance.status in ["CREATED", "PAYMENT"]:
|
||||||
if not instance.is_whole_digital:
|
if not instance.is_whole_digital:
|
||||||
send_order_created_email.delay(instance.uuid) # type: ignore [attr-defined]
|
send_order_created_email.delay(str(instance.uuid))
|
||||||
|
|
||||||
for order_product in instance.order_products.filter(status="DELIVERING", product__is_digital=True):
|
for order_product in instance.order_products.filter(status="DELIVERING", product__is_digital=True):
|
||||||
if not order_product.product:
|
if not order_product.product:
|
||||||
|
|
@ -154,7 +154,7 @@ def process_order_changes(instance: Order, created: bool, **kwargs: dict[Any, An
|
||||||
if instance.status == "FINISHED" and not instance.attributes.get("system_email_sent", False):
|
if instance.status == "FINISHED" and not instance.attributes.get("system_email_sent", False):
|
||||||
instance.attributes["system_email_sent"] = True
|
instance.attributes["system_email_sent"] = True
|
||||||
instance.save()
|
instance.save()
|
||||||
send_order_finished_email.delay(instance.uuid) # type: ignore [attr-defined]
|
send_order_finished_email.delay(str(instance.uuid))
|
||||||
|
|
||||||
|
|
||||||
# noinspection PyUnusedLocal
|
# noinspection PyUnusedLocal
|
||||||
|
|
@ -179,4 +179,4 @@ def update_category_name_lang(instance: Category, created: bool, **kwargs: dict[
|
||||||
@receiver(post_save, sender=PromoCode)
|
@receiver(post_save, sender=PromoCode)
|
||||||
def send_promocode_creation_email(instance: PromoCode, created: bool, **kwargs: dict[Any, Any]) -> None:
|
def send_promocode_creation_email(instance: PromoCode, created: bool, **kwargs: dict[Any, Any]) -> None:
|
||||||
if created:
|
if created:
|
||||||
send_promocode_created_email.delay(instance.uuid) # type: ignore [attr-defined]
|
send_promocode_created_email.delay(str(instance.uuid))
|
||||||
|
|
|
||||||
|
|
@ -52,4 +52,4 @@ def process_transaction_changes(instance: Transaction, created: bool, **kwargs:
|
||||||
success = instance.process.get("success", False)
|
success = instance.process.get("success", False)
|
||||||
|
|
||||||
if ("success" in status or success) and (instance.process.get("notify", False)):
|
if ("success" in status or success) and (instance.process.get("notify", False)):
|
||||||
balance_deposit_email.delay(instance.uuid) # type: ignore [attr-defined]
|
balance_deposit_email.delay(str(instance.uuid))
|
||||||
|
|
|
||||||
|
|
@ -207,7 +207,7 @@ class TokenRefreshSerializer(Serializer):
|
||||||
|
|
||||||
self.retrieve_user: bool = retrieve_user
|
self.retrieve_user: bool = retrieve_user
|
||||||
|
|
||||||
def validate(self, attrs: dict[str, Any]) -> dict[str, str]:
|
def validate(self, attrs: dict[str, Any]) -> dict[str, Any]:
|
||||||
refresh = self.token_class(attrs["refresh"])
|
refresh = self.token_class(attrs["refresh"])
|
||||||
|
|
||||||
data: dict[str, str | dict[str, Any]] = {"access": str(refresh.access_token)}
|
data: dict[str, str | dict[str, Any]] = {"access": str(refresh.access_token)}
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ class UserViewSet(
|
||||||
with suppress(User.DoesNotExist):
|
with suppress(User.DoesNotExist):
|
||||||
user = User.objects.get(email=request.data.get("email"))
|
user = User.objects.get(email=request.data.get("email"))
|
||||||
if user:
|
if user:
|
||||||
send_reset_password_email_task.delay(user_pk=user.uuid) # type: ignore [attr-defined]
|
send_reset_password_email_task.delay(user_pk=str(user.uuid))
|
||||||
return Response(status=status.HTTP_200_OK)
|
return Response(status=status.HTTP_200_OK)
|
||||||
|
|
||||||
@action(detail=True, methods=["put"], permission_classes=[IsAuthenticated])
|
@action(detail=True, methods=["put"], permission_classes=[IsAuthenticated])
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue