From 2c4988d2c62e1b7a08e23c07965acbc0641395db Mon Sep 17 00:00:00 2001 From: Parsa Nazer Date: Mon, 17 Feb 2025 00:52:29 +0330 Subject: [PATCH] image for notif --- backend/account/models.py | 4 ++-- backend/order/models.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/account/models.py b/backend/account/models.py index c1b59b5..ceb9366 100644 --- a/backend/account/models.py +++ b/backend/account/models.py @@ -151,11 +151,11 @@ class PushSubscription(models.Model): def __str__(self): return f'{self.user} push' - def send_notif(self, title, body): + def send_notif(self, title, body, icon=''): payload = { "title": title, "body": body, - "icon": '' + "icon": icon } try: diff --git a/backend/order/models.py b/backend/order/models.py index 86b2ae5..27bc19f 100644 --- a/backend/order/models.py +++ b/backend/order/models.py @@ -1,6 +1,6 @@ from django.db import models from account.models import User, UserAddressModel, PushSubscription -from product.models import ProductModel, ProductVariant +from product.models import ProductModel, ProductVariant, ProductImageModel from django.utils import timezone from .execptions import DiscountNotAvailableError @@ -53,7 +53,7 @@ class OrderModel(models.Model): except: print('object not found') try: - push_object.send_notif(f'سفارش شما به {self.status} تغییر کرد', f'سفارش شما به {self.status} تغییر کرد') + push_object.send_notif(f'سفارش شما به {self.status} تغییر کرد', f'سفارش شما به {self.status} تغییر کرد', ProductImageModel.objects.all().first().image.url) except: print('didnt send') super().save(*args, **kwargs)