def get_total(self, discounts=None): """Return the total cost of the cart prior to shipping.""" if not discounts: discounts = self.discounts subtotals = [line.get_total(discounts) for line in self.lines.all()] if not subtotals: raise AttributeError('Calling get_total() on an empty cart') return sum_prices(subtotals)
def get_total(self, discounts=None): subtotals = [line.get_total(discounts) for line in self] if not subtotals: raise AttributeError( 'Calling get_total() on an empty product group') return sum_prices(subtotals)