#14497: ModelAdmin.readonly_fields isn't graceful with filefields.
-------------------------------------+-------------------------------------
Reporter: Keryn Knight | Owner:
<keryn@…> | paulcollins
Type: New feature | Status: new
Component: contrib.admin | Version: 1.2
Severity: Normal | Resolution:
Keywords: feature admin | Triage Stage: Design
readonly filefield | decision needed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------
Changes (by paulcollins):
* stage: Accepted => Design decision needed
Comment:
Replying to [comment:16 julien]:
> I've also noticed that the same display logic is used on the changelist
when a file field is in `list_display`.
[[BR]]
Uhoh. So this is something I completely missed. It seems that
display_for_field is implicitly expected to just return a text value, not
an HTML value.
If a read only file field is listed in the `list_display` then in the
admin the link to edit that object vanishes. The HTML ends up looking like
<a href='link to admin page'><a href='link to
file'>filepath/filename</a></a>. Worse, if it's the only thing listed in
`list_display` it leaves the end user no obvious way to go and actually
edit the object.
An icky feeling fix would be to go and put the special case logic for this
in contrib.admin.helpers.AdminReadonlyField.contents which is what's being
called to display it on the modify object page. After some discussion with
julien though, I'm kicking this back to DDN. Maybe at some point the
AdminReadonlyField class will be refactored to allow for this kind of
flexibility.
--
Ticket URL: <https://code.djangoproject.com/ticket/14497#comment:17>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.