Ticket #7968: modelforms-doc-imagefields.diff

File modelforms-doc-imagefields.diff, 1.2 KB (added by sime, 6 years ago)

Brief note about existing behaviour, and a suggestion on how to handle removing existing images/files

1Index: docs/modelforms.txt
3--- docs/modelforms.txt (revision 7804)
4+++ docs/modelforms.txt (working copy)
5@@ -55,7 +55,7 @@
6     ``FilePathField``                ``CharField``
7     ``FloatField``                   ``FloatField``
8     ``ForeignKey``                   ``ModelChoiceField`` (see below)
9-    ``ImageField``                   ``ImageField``
10+    ``ImageField``                   ``ImageField`` (see below)
11     ``IntegerField``                 ``IntegerField``
12     ``IPAddressField``               ``IPAddressField``
13     ``ManyToManyField``              ``ModelMultipleChoiceField`` (see
14@@ -112,6 +112,11 @@
15       field has ``blank=False`` and an explicit ``default`` value (the
16       ``default`` value will be initially selected instead).
18+When ``ImageField`` or ``FileField`` fields are left blank by the user, they
19+will be skipped during a ``save()``. Any existing image or file will remain.
20+We suggest you use a BooleanField to allow the user to remove an existing
21+image or file.
23 Finally, note that you can override the form field used for a given model
24 field. See `Overriding the default field types`_ below.