Created
January 3, 2021 16:25
-
-
Save klement97/ba52b146473ca28c846abd2b9ee8a40a 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 the following: | |
- Pizza total price | |
- Size price | |
- Sum of toppings | |
""" | |
price = self.pizza.total_price + self.size.price | |
for topping in self.extra_toppings.all(): | |
price += topping.price | |
return price |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment