#27383: Regression: `FileField(default=None)` now never upload a file through a
ModelForm
-------------------------------------+-------------------------------------
     Reporter:  Maxime Lorant        |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  File                 |                  Version:  1.10
  uploads/storage                    |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Maxime Lorant):

 * needs_better_patch:   => 0
 * needs_tests:   => 0
 * needs_docs:   => 0


Old 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?

New 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 change back the behaviour?

--

--
Ticket URL: <https://code.djangoproject.com/ticket/27383#comment:1>
Django <https://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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.ea0be4a6e38b8e0bb45eb22d2adc6342%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to