structre product cart response
This commit is contained in:
@@ -77,19 +77,6 @@ class OrderModel(models.Model):
|
||||
super().save(*args, **kwargs)
|
||||
|
||||
|
||||
def discount_list(self):
|
||||
items_with_discount = self.items.filter(product__discount__gt=0)
|
||||
discount_amount_dict = [{'product_name': f'{item.product}', 'discount': f'{item.product.discount}', 'discount_amount': ''} for item in items_with_discount]
|
||||
|
||||
if self.discount_code:
|
||||
|
||||
if self.discount_code.is_valid():
|
||||
discount_amount_dict['discount_code_discount'] = 10
|
||||
else:
|
||||
self.discount = None
|
||||
self.save()
|
||||
|
||||
return discount_amount_dict
|
||||
|
||||
def discount(self):
|
||||
# total_with_item_discount = sum(item.total_with_discount() for item in self.items.all())
|
||||
|
||||
Reference in New Issue
Block a user