I have model which among other fields contains
price = forms.IntegerField()
model = models.Shipment
fields = [
form = ShipmentForm
See ModelAdmin.readonly_fields (Django 1.10 docs link).
A read-only field can not only display data from a model’s field, it can also display the output of a model’s method or a method of the ModelAdmin class itself.
This means that you can do:
class ShipmentAdmin(admin.ModelAdmin): readonly_fields = ('price', 'something_else') def something_else(self, instance): # calculate something else here
price is a model method, and
something_else is a ModelAdmin method.