Skip to content

Instantly share code, notes, and snippets.

@klement97
Created January 3, 2021 16:23
Show Gist options
  • Save klement97/6b7251091fd4e1a52f7c3c1b564c66a1 to your computer and use it in GitHub Desktop.
Save klement97/6b7251091fd4e1a52f7c3c1b564c66a1 to your computer and use it in GitHub Desktop.
@property
def total_price(self) -> Decimal:
"""
Total price is sum of pizza prices in this order.
"""
price = Decimal(0)
for pizza in self.pizzas.all():
price += pizza.total_price
return price
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment