Opened 8 years ago

Closed 8 years ago

#27246 closed New feature (wontfix)

Factor out input template in ClearableFileInput and document template class attributes

Reported by: Martin Pauly Owned by: Martin Pauly
Component: Forms Version: 1.10
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

ClearableFileInput uses a template variable in its render() implementation (see https://github.com/django/django/blob/master/django/forms/widgets.py#L405) that I would like to factor out as a class attribute.

This would allow to change the appearance of the 'Select file' button for ClearableFileInput, by e.g. wrapping it in a div and adding a span. For normal FileInput that is already possible by overwriting the render method, however for ClearableFileInput this gets comparably ugly.
This would be in line with having the other template strings as class attributes.

Also I believe it would be good to document the multiple template_* class attributes.

Change History (2)

comment:1 by Martin Pauly, 8 years ago

Owner: changed from nobody to Martin Pauly
Status: newassigned

comment:2 by Tim Graham, 8 years ago

Resolution: wontfix
Status: assignedclosed

We're targeting template-based widget rendering (#15667) for Django 1.11 which I believe obsoletes this. Feel free to take at the latest pull request there and offer feedback.

Note: See TracTickets for help on using tickets.
Back to Top