image for notif

This commit is contained in:
Parsa Nazer
2025-02-17 00:52:29 +03:30
parent e118f5c7d2
commit 2c4988d2c6
2 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -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:
+2 -2
View File
@@ -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)