Opened 6 years ago

Closed 5 years ago

#19464 closed New feature (fixed)

The markup for ClearableFileInput's link should be a widget template string

Reported by: Ruy Asan Owned by: nobody
Component: Forms Version: 1.5-beta-1
Severity: Normal Keywords: widget ClearableFileInput
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


ClearableFileInput already makes great use of class attribute to let us customize various templates and wording details, except, notably (and sadly) the markup for the actual link.

This could easily be made to fall in line with the other templates, and covers the fairly common use case of wanting a more appropriate inline preview (e.g. img tags for ImageField widgets).

Attachments (1)

url_markup_template.diff (1.0 KB) - added by Ruy Asan 6 years ago.

Download all attachments as: .zip

Change History (7)

Changed 6 years ago by Ruy Asan

Attachment: url_markup_template.diff added

comment:1 Changed 6 years ago by Ruy Asan

Has patch: set

have a patch why not

comment:2 Changed 6 years ago by Claude Paroz

Triage Stage: UnreviewedAccepted
Type: UncategorizedNew feature

comment:3 Changed 5 years ago by Tomek Paczkowski

Needs documentation: set
Needs tests: set

comment:4 Changed 5 years ago by Ruy Asan

Err... as far as as I can tell, this is an internal implementation detail that is only relevant when sub-classing - it's not really documented for any of the other widgets.

Nor is this change specifically testable - unless you mean this breaks an existing test (which I didn't think it did...)

comment:5 Changed 5 years ago by Carl Meyer

Needs documentation: unset
Needs tests: unset

I agree that this is an internal refactoring for better subclassability and does not require new tests, only that all existing tests pass.

A case could be made that if we're refactoring widget implementations specifically to make them more easily subclassable, we should also document those class attributes intended for overriding; otherwise we're encouraging reliance on undocumented implementation details. I don't feel strongly enough about that to block this going in, though.

comment:6 Changed 5 years ago by Claude Paroz <claude@…>

Resolution: fixed
Status: newclosed

In 51cc7029b96d028989e92a185a2f88b89283d287:

Fixed #19464 -- Eased customization of ClearableFileInput's link markup

Thanks rubyruy for the report and the patch.

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