TypeError with calculated field
unsupported operand type(s) for *: 'int' and 'NoneType'
error in the return line below
models.py
def get_subtotal(self):
return self.price_sale * self.quantity
subtotal = property(get_subtotal)
admin.py
class SaleDetailInline(admin.TabularInline):
list_display = ['product', 'quantity', 'price_sale', 'subtotal']
readonly_fields = ['subtotal', ]
model = SaleDetail
extra = 0
In the view the subtotal works, but not in Admin.