Opened 8 years ago

Last modified 8 years ago

#27383 closed Bug

Regression: `FileField(default=None)` now never upload a file through a ModelForm — at Initial Version

Reported by: Maxime Lorant Owned by: nobody
Component: File uploads/storage Version: 1.10
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

We had in our code the following line (don't ask why, I don't know):

class SomeModel(models.Model):
     foo = ...
     bar = ...
     file = models.FileField(null=True, blank=True, default=None)


class SomeModelForm(forms.ModelForm):
     class Meta:
          fields = ('foo', 'bar', 'file', )

It was working until Django 1.9.x, but switching to Django 1.10, submission of files through a ModelForm stopped working. I found a solution by removing the useless default=None. Even though its usefulness can be questioned, it looks like it is a regression not documented in the release notes.

Should we bother adding it or fix it?

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top