Я хочу загрузить несколько изображений, используя django 3. Здесь My,
**Model:**
class Image(models.Model):
file = models.ImageField(upload_to='images/')
**form:**
class UploadForm(forms.Form):
images = MultiImageField(min_num=1, max_num=3, max_file_size=1024*1024*5)
**Views:**
class UploadView(FormView):
template_name = 'html/form.html'
form_class = UploadForm
success_url = '/done/'
def form_valid(self, form):
for each in form.cleaned_data['images']:
Image.objects.create(file=each)
return super(UploadView, self).form_valid(form)
**urls.py:**
path('upload', views.UploadView.as_view(), name="upload"),
**Finally form.html:**
<form action="" method="post" enctype="multipart/form-data">
{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="Send" />
</form>
Но я получаю ошибку:
AttributeError at / upload 'list 'У объекта нет атрибута' name '