models.py
class Head(models.Model):
total_amount=models.DecimalField(max_digits=9,decimal_places=2)
class Items(models.Model):
head = models.ForeignKey(Head)
item_amount=models.DecimalField(max_digits=9,decimal_places=2)
admin.py
class ItemsInline(admin.TabularInline):
model = Items
class HeadAdmin(admin.ModelAdmin:
inlines = [ItemsInline]
admin.site.register(Head,HeadAdmin)
Question
After fill in 3 items inline of HeadAdmin, how to sum all of item amounts and place to total_amount in Head after click save?