﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
28148	Document addition of validate_image_file_extension() as a backwards incompatible change for ImageField	rm_	nobody	"The following test code snippet stopped working after upgrading django to 1.11 from 1.10.x. The code now raises a validation error because the posted image has not a valid file extension:

{{{
class Test(TestCase):
    def test_post(self):
        img = BytesIO(IMAGE)
        data = {
            'image': img,
        }
        response = self.client.post(url, data=data)
}}}

The view takes the data and fill the following ModelForm that fails validation:

{{{
class Image(models.Model):
    image = models.ImageField(_(u'Immagine'), upload_to='image')


class ImageForm(forms.ModelForm):
    class Meta:
        model = Image
}}}

As a workaround, adding a name attribute to the BytesIO object make the code work again:

{{{
        img.name = 'ciao.jpg'
}}}"	Cleanup/optimization	closed	Documentation	1.11	Normal	fixed			Accepted	1	0	0	0	1	0
