Open mujad opened 1 year ago
I can confirm I'm still having this issue.
Is it possible this should be fixed in Django itself? It looks like when you make a field read-only it shows a plain-text representation instead of the appropriate widget. It would make more sense if Django modified only the default widget when a field is set to read-only.
I briefly looked at the Django docs and didn't see anything to suggest this is intended behaviour.
This StackOverflow answer (from 2013) seems to confirm it's a Django behaviour:
When field is set to readonly, Django uses display_for_field function which hardcodes the result, you can't customize it.
Have you found a work-a-round?
Description
when I make my model readonly widget not work !
`class ReadOnlyAdminModel(admin.ModelAdmin): formfield_overrides = { models.JSONField: {'widget': JSONEditorWidget}, }
`
What I Did