Code

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#10299 closed (duplicate)

Enhance FileField form field with "delete" checkbox when file is loaded

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

Description

Currently Django displays the FileField and ImageField with file upload HTML widget only. This allows for uploading the new file or image and overwritting already stored file or image with a newer version. But it doesn't give you an option to delete the uploaded file or image. To overcome this problem one must provide a separate CheckboxInput and handle its logic in a view specifically to delete the file.

So, the point is to enhance the FileField and ImageField widgets with checkbox which appear in HTML only when file or image is already loaded. The proposed label for checkbox is "Delete". When checkbox is ticked and new file is not provided the correspoding file (or image) must be deleted on server.

Attachments (0)

Change History (8)

comment:1 Changed 5 years ago by Valera_Grishin

  • Cc valera.grishin@… added
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 5 years ago by Alex

  • Resolution set to duplicate
  • Status changed from new to closed

This is a dupe of #7048.

comment:3 Changed 5 years ago by kmtracey

The title of #7048 specifically mentions "admin", thus it isn't immediately obvious that this broader issue is a dupe. It's quite possible the solution envisioned for #7048 will be general and useful/accessible outside of admin, but it would be nice, if that is the case, if that were made more clear. It isn't immediately obvious to me from a brief scan of that ticket.

comment:4 Changed 5 years ago by Alex

Karen, I agree that it wasn't immediately obvious, however if you take a look at the patch it does appear that the new Field and Widgets are in the forms dir, so they darn well better be reusable ;).

comment:5 Changed 5 years ago by kmtracey

Yeah, if you read it closely the solution is for ModelForms in general. I updated the summary to reflect that.

comment:6 follow-up: Changed 5 years ago by Valera_Grishin

  • Cc valera.grishin@… removed
  • Resolution duplicate deleted
  • Status changed from closed to reopened

comment:7 Changed 5 years ago by Valera_Grishin

  • Resolution set to duplicate
  • Status changed from reopened to closed

comment:8 in reply to: ↑ 6 Changed 5 years ago by Valera_Grishin

Replying to Valera_Grishin:
Is something wrong with Track? I only changed the cc, but didn't touch status and resolution. Why those changed too?

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


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

 
Note: See TracTickets for help on using tickets.