#30577: 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:  Accepted
    Has patch:  0              |      Needs documentation:  0
  Needs tests:  0              |  Patch needs improvement:  0
Easy pickings:  0              |                    UI/UX:  0
-------------------------------+------------------------------------
Comment (by Richard Laager):

 Removing support for the `read_only` property on widgets (i.e. the
 "workaround" for `ReadOnlyPasswordHashWidget`) will break a number of
 things for me at $DAYJOB. We use the `read_only` property on a number of
 custom widgets. One use-case is very similar to that being discussed here,
 but that is not the only use case we have.

 I urge you to revert that change immediately, until this is worked out.

 For the long-term, I think ideally you should have a concept of a widget
 rendering read-only, similar to the concept of a widget rending disabled.
 Then, `readonly_fields` should render using that mechanism. Lastly,
 instead of the existing behavior where the "view" form puts all the fields
 in `exclude` and then something later adds back pseudo-fields using
 `AdminReadonlyField`, they should instead be `readonly_fields`, which
 would use the new read-only widget rendering. The behaviors of
 `AdminReadonlyField` would be merged into the stock widgets as their read-
 only rendering behavior. `AdminReadonlyField` would go away (probably with
 a deprecation period for backwards-compatibility).

 Put differently, there are currently multiple different ways of handling
 fields being read-only. I propose to unify those all into a mode where the
 Widget can render in a read-write way (the default, and as exists today)
 or in read-only mode (using the behaviors from `AdminReadonlyField`).

 I think having the Widget render read-write vs read-only makes more sense
 than the proposed `readonly_formfield_overrides` which requires separate
 Widget classes for read-write vs read-only.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/30577#comment:16>
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/0107019a4c62d16b-0e5a13a0-06f6-4616-956f-684e6ad5ed43-000000%40eu-central-1.amazonses.com.

Reply via email to