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