Skip to content

Instantly share code, notes, and snippets.

@klement97
Created January 3, 2021 16:18
Show Gist options
  • Save klement97/d0545bb35dc854181c65837cb29a7647 to your computer and use it in GitHub Desktop.
Save klement97/d0545bb35dc854181c65837cb29a7647 to your computer and use it in GitHub Desktop.
@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