Created
January 3, 2021 16:23
-
-
Save klement97/6b7251091fd4e1a52f7c3c1b564c66a1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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