Search code examples
pythondjangodjango-modelsdjango-admin

Django admin: How to display the field marked as "editable=False" in the model?


Even though a field is marked as 'editable=False' in the model, I would like the admin page to display it. Currently, it hides the field altogether.. How can this be achieved?


Solution

  • Use Readonly Fields. Like so (for django >= 1.2):

    class MyModelAdmin(admin.ModelAdmin):
        readonly_fields=('first',)