4. How to show an uneditable field in admin?¶
If you have a field with
editable=False in your model, that field, by default, is hidden in the change page. This also happens with any field marked as
auto_now_add, because that sets the
editable=False on these fields.
If you want these fields to show up on the change page, you can add them to
@admin.register(Villain) class VillainAdmin(admin.ModelAdmin, ExportCsvMixin): ... readonly_fields = ["added_on"]
With this change the Villain admin looks like this: