#7048: Support clearing FileFields with ModelForms
-------------------------------+--------------------------------------------
Reporter: jarrow | Owner: carljm
Status: new | Milestone:
Component: Forms | Version: SVN
Resolution: | Keywords:
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 1
Needs_better_patch: 0 |
-------------------------------+--------------------------------------------
Comment (by carljm):
Added a new patch with these design choices:
* No file deleting.
* Clearability should be the default behavior of a
forms.FileField(required=False) - and thus also
models.FileField(blank=True).formfield(). It's a bug that FileFields are
currently not clearable. Thus, no Meta options or extra field arguments
are needed.
* This involves a minor backwards incompatibility in form rendering (a
possible checkbox where there was not one previously), which is documented
in the 1.3 release notes.
* It doesn't make sense to have a clearable file input that doesn't
display the current value of the field, so that behavior is moved from
AdminFileWidget to ClearableFileInput (which AdminFileWidget inherits).
* The HTML rendering of the ClearableFileInput is customizable by
subclassing and overriding some class attributes.
* Contradictory input (checking the clear checkbox and simultaneously
uploading a new file) results in a form validation error.
All of these design choices were checked in person with at least one core
committer at the sprint, mostly with Malcolm.
For reviewers more comfortable with git, here is the github compare URL
for my working branch for this patch:
http://github.com/carljm/django/compare/master...ticket_7048
--
Ticket URL: <http://code.djangoproject.com/ticket/7048#comment:49>
Django <http://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.