My problem is simple. I have a template:
<form enctype="multipart/form-data" action="{% url offers.views.add_offer %}" method="post"> <input type="file" name="image1" /> <input type="file" name="image2" /> <input type="submit" value="Add" /> </form>
The model is as follows:
class Image(models.Model): image = models.ImageField(upload_to='uploads/images/offers/')
And forms like this (it uses a model image):
class ImageForm(ModelForm): class Meta: model = Image
And look like this:
for f in request.FILES:
The problem is that I cannot upload images. I want to save the image in two separate instances of the image model.
I have an error:
'unicode' object has no attribute 'get'
Thanks for any help and answer.
Updated for more information.
source share