ImageField not validating in Django ModelForm
The other day I was working on a Django ModelForm that had an ImageField in it and to my great surprise the ImageField would not validate in the ModelForm, even when I had selected an image. The solution was simple enough: add request.FILES to the instantiation parameters of the ModelForm.. DUH!
#ProfileForm is a ModelForm
form = ProfileForm(request.POST, request.FILES, instance=profile)
Leave a Reply