admin broken on FileField with blank=True
|Reported by:||malte||Owned by:||nobody|
|Component:||Core (Management commands)||Version:||1.0|
|Severity:||Keywords:||admin filefield bug|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Description (last modified by ramiro)
If you have a FileField declared like so:
image_1 = models.FileField(upload_to=get_image_path, null=True, blank=True)
Then in django admin, the field becomes voluntary as it should. If you save a file in an optional field that works as expected. But if you come back to the item in the admin, and just hit 'save' without touching the optional file that is uploaded, the db record gets updated with a blank value for the FileField, effectively killing the connection with the file.
I'm using Sqlite, may make a difference here I suppose.
Change History (6)
comment:1 Changed 7 years ago by Alex
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset