Code

Opened 7 months ago

Last modified 6 months ago

#21201 assigned New feature

Let ClearableFileInput work with other fields

Reported by: vzima Owned by: vzima
Component: Forms Version: master
Severity: Normal Keywords:
Cc: EvilDMP Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

ClearableFileInput is very useful widget, problem is that it can only be used with FileField as it only expects FieldFile as an initial value.

I propose a decomposition (see patch) which allows easy modification to use this widget with other fields.

Example: File input is used over data which are stored in database.

This problem is remotely connected with #15667 which may (or may not) solve this issue.

Attachments (1)

clearable-file-input.patch (2.6 KB) - added by vzima 7 months ago.

Download all attachments as: .zip

Change History (7)

Changed 7 months ago by vzima

comment:1 Changed 7 months ago by EvilDMP

  • Cc EvilDMP added
  • Needs documentation unset
  • Needs tests set
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 follow-up: Changed 7 months ago by EvilDMP

  • Needs documentation set

comment:3 in reply to: ↑ 2 Changed 7 months ago by vzima

Replying to EvilDMP:
Do you have in mind any particular changes in documentation beside note in changelog? Current documentation does not describe these internals of the widget.

comment:4 Changed 7 months ago by EvilDMP

docs/forms/ref/widgets.txt documents ClearableFileInput, but not the internals; I don't see any particular need to document internals of widgets. Perhaps an example of usage would be helpful.

comment:5 Changed 7 months ago by EvilDMP

This patch does change the behaviour of the widget, so we will need to understand any backwards-compatibility implications of it.

comment:6 Changed 6 months ago by vzima

  • Needs documentation unset
  • Needs tests unset
  • Owner changed from nobody to vzima
  • Status changed from new to assigned

I have updated a patch and created pull request https://github.com/django/django/pull/1807

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as assigned
The owner will be changed from vzima to anonymous. Next status will be 'assigned'
The ticket will be disowned. Next status will be 'new'
as The resolution will be set. Next status will be 'closed'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.