push notificantion test
This commit is contained in:
+11
-1
@@ -45,7 +45,17 @@ 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')
|
||||
super().save(*args, **kwargs)
|
||||
|
||||
def total_with_discount(self):
|
||||
total_with_item_discount = sum(item.total_with_discount() for item in self.items.all())
|
||||
|
||||
Reference in New Issue
Block a user