[ACCEPTED]-Django Imagefield not working properly via ModelForm-django-models
Accepted answer
Well I feel like an idiot. In order for 8 Django to be able to process uploaded files, you 7 need to pass the request.FILES variable 6 to the form (makes sense, right?!)
In my 5 case the following line goes from:
f = AdminEditForm(request.POST, instance = company)
To:
f = AdminEditForm(request.POST, request.FILES, instance = company)
Another 4 thing to check (if you run into something 3 like this in the future) is that your form 2 is multipart. Your <form>
tag should look something 1 like this:
<form enctype="multipart/form-data" method="post" action="">
This happened to me because I was missing 2 the "name" attribute for the file 1 input.
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.