#30577: feature request: custom rendering for readonly fields in admin
-------------------------------+--------------------------------------
Reporter: David | Owner: nobody
Type: New feature | Status: new
Component: contrib.admin | Version: 5.1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by Gagan Deep):
* resolution: needsinfo =>
* status: closed => new
Comment:
Hello everyone,
I recently added a comment on the [https://forum.djangoproject.com/t
/feature-request-discussion-custom-rendering-for-readonly-fields-in-
admin/32009/5 related Django forum thread] regarding the
[https://github.com/django/django/commit/d755a98b8438c10f3cff61303ceb1fe16d414e9b
removal of the workaround for `ReadOnlyPasswordHashWidget`] that allowed
custom widgets to be used for rendering readonly fields in the Django
admin.
As a result of this change, it's no longer possible to customize the
rendering of readonly fields using widgets. To demonstrate this, I’ve
created a [https://github.com/openwisp/django-readonly-issue-demo-30577
minimal project] comparing Django 5.2 and the latest development version
(installed from the `main` branch on GitHub).
'''Django 5.2: custom widget used for readonly field'''
[[Image(https://raw.githubusercontent.com/openwisp/django-readonly-issue-
demo-30577/refs/heads/main/docs/images/django-5.2.png, height=300px)]]
'''Development version: default admin rendering used'''
[[Image(https://raw.githubusercontent.com/openwisp/django-readonly-issue-
demo-30577/refs/heads/main/docs/images/django-6.0.png, height=300px)]]
At [https://openwisp.org/ OpenWISP], we leveraged this workaround in
Django <= 5.2.x to render the `django-leaflet` widget for users with view-
only permissions. Moreover, we want to [https://github.com/openwisp
/openwisp-controller/issues/848 utilize this functionality to render
properly formatted JSON in the Django admin].
> This will need to be clear what we see and what we want to see instead.
I believe the above screenshots with the [https://github.com/openwisp
/django-readonly-issue-demo-30577 demo project] make the intended outcome
clear.
Since the workaround is no longer allowed, I urge the maintainers to
reconsider this feature request.
--
Ticket URL: <https://code.djangoproject.com/ticket/30577#comment:13>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/django-updates/01070198386ed301-8d1a7051-bf01-4cd7-913b-b34e31b718f8-000000%40eu-central-1.amazonses.com.