Model
class GateSale(models.Model):
combinedGateProfit = models.DecimalField('Combined Gate Profit', null=True, blank=True, max_digits= 8, decimal_places=2)
fiftyFiftyTotal = models.DecimalField('Fifty-Fifty Total', null=True, blank=True, max_digits= 8, decimal_places=2)
officialsTotal = models.DecimalField('Officials', null=True, blank=True, max_digits= 8, decimal_places=2)
@admin.display(description='gameProfit')
def gameProfit(self):
gameProfit = (GateSale.combinedGateProfit + (GateSale.fiftyFiftyTotal/2)) - GateSale.officialsTotal
return '%d' % (gameProfit)
Admin
from .models import GateSale
@admin.register(GateSale)
class GateSaleAdmin(admin.ModelAdmin):
list_display = (
'gameProfit'
)
Error
TypeError at /admin/website/gatesale/
unsupported operand type(s) for /: 'DeferredAttribute' and 'int'