Carl Meyer avatar Carl Meyer committed 0b3f1fc

add TODO.rst with note about ClearableFileField oddities

Comments (0)

Files changed (1)

+django-form-utils TODO
+======================
+
+ClearableFileField
+~~~~~~~~~~~~~~~~~~
+
+Behavior on bound-redisplay is a bit funky, because of hardcoded
+special-casing of FileField in Django's forms.py. FileField's are
+special-cased in BaseForm._clean_fields to receive initial (in
+addition to submitted) data in their clean() method, and also in
+BoundField.as_widget() to have initial data rendered as the value if
+no new data was submitted. Since we inherit from MultiValueField
+rather than FileField, we don't get this special-casing, and so our
+FileField always renders empty on bound redisplay when a regular
+FileField would render the initial data.
+
+Ideally Django would be fixed to remove this special-casing of
+FileField, either making it polymorphic behavior on fields/widgets or
+based on a Field class attribute flag, or some such. Then we could
+pretend to be a FileField and be able to emulate that behavior.
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.