for all status

This commit is contained in:
Parsa Nazer
2025-02-17 00:34:21 +03:30
parent d6390118ce
commit e118f5c7d2
+8 -9
View File
@@ -48,15 +48,14 @@ class OrderModel(models.Model):
# def total_without_tax(self):
# return sum(item.total() for item in self.items.all())
def save(self, *args, **kwargs):
if self.status == 'POSTED':
try:
push_object = PushSubscription.objects.get(user=self.user)
except:
print('object not found')
try:
push_object.send_notif('سفارش شما به پست شده تغییر کرد', 'سفارش شما به پست شده تغییر کرد')
except:
print('didnt send')
try:
push_object = PushSubscription.objects.get(user=self.user)
except:
print('object not found')
try:
push_object.send_notif(f'سفارش شما به {self.status} تغییر کرد', f'سفارش شما به {self.status} تغییر کرد')
except:
print('didnt send')
super().save(*args, **kwargs)
def total_with_discount(self):