Skip to content

Commit

Permalink
add items summary method
Browse files Browse the repository at this point in the history
  • Loading branch information
dfalk committed Jan 29, 2012
1 parent 01c9870 commit f959051
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cart/cart.py
Expand Up @@ -74,6 +74,12 @@ def count(self):
for item in self.cart.item_set.all(): for item in self.cart.item_set.all():
result += 1 * item.quantity result += 1 * item.quantity
return result return result

def summary(self):
result = 0
for item in self.cart.item_set.all():
result += item.total_price
return result


def clear(self): def clear(self):
for item in self.cart.item_set.all(): for item in self.cart.item_set.all():
Expand Down

0 comments on commit f959051

Please sign in to comment.