image for notif
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user