How to make a field read-only in Django admin?
In this tutorial, we will provide How to make a field read-only in Django admin. Django admin by default shows all fields as editable and this fields option will display its data as-is and non-editable. we use readonly_fields is used without defining explicit ordering through ModelAdmin or ModelAdmin.fieldsets they will be added. Now we make the Question text fields read-only.
Example
@admin.register(Question)
class QuestionAdmin(admin.ModelAdmin):
...
readonly_fields = ["question_text"]
Output
