Created
January 3, 2021 16:18
-
-
Save klement97/d0545bb35dc854181c65837cb29a7647 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 all topping prices. | |
""" | |
price = Decimal(0) | |
for topping in self.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