diff --git a/backend/order/models.py b/backend/order/models.py index d41f476..86b2ae5 100644 --- a/backend/order/models.py +++ b/backend/order/models.py @@ -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):