You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, after doing that the JSONEditor is no longer displayed. Is this expected? My expectation was to see the JSONEditor in read only mode as well. It works if I put all fields in readonly_fields in the model admin class.
I compared the HTML file and noticed that this package static files (JS, CSS) are not included when the has_change_permission returns False.
Thanks in advance for your help
The text was updated successfully, but these errors were encountered:
As I could ensure, in both cases, for the readonly_fields attribute, as well as for the has_change_permissions method, the JSON field is not shown, and the JSON content is shown instead, like here:
It is a result of the Django code where a special class AdminReadonlyField is used when rendering readonly admin form fields. I didn't find any way to customize this behaviour yet. If you could implement such a feature, i.e. showing JSONEditor (and ACEEditor) in the readonly mode when the field is not editable for some reason (editable=False, has_change_permission, or readonly_fields) you are welcome to make a PR for this feature.
But notice that the field itself is yet really editable, and the POST will able to send a new value, till the field is not really readonly. For the full-featured solution the field itself should be read-only for one of the reasons listed before, but the widget should be rendered in the special readonly mode (disabled is an appropriate mode), instead of rendering content of the field, as the Admin Form does.
I suspect that if you will create ModelForm with readonly fields instead of using Admin Form provided by the admin application, you will get some appropriate result. The question is, how to provide this feature back to the Admin Form.
Hi,
First of all. Thanks for your work on this lib.
I disabled the change permission with this code in the model admin class:
However, after doing that the JSONEditor is no longer displayed. Is this expected? My expectation was to see the JSONEditor in read only mode as well. It works if I put all fields in
readonly_fields
in the model admin class.I compared the HTML file and noticed that this package static files (JS, CSS) are not included when the
has_change_permission
returns False.Thanks in advance for your help
The text was updated successfully, but these errors were encountered: