title: Django formset creates multiple inputs for multiple image upload
body: <p>I am trying to create a simple post sharing form like this one.</p>
  
  <p><a href="https://i.stack.imgur.com/ICqPg.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ICqPg.png" alt="enter image description here"></a></p>
  
  <p>I'm using formset for image upload. But this gives me multiple input as you can see. Also each input can choose single image. But I'm trying to upload multiple image with single input.</p>
  
  <p>views.py</p>
  
  <pre><code>def share(request):
  
      ImageFormSet = modelformset_factory(Images,
                                          form=ImageForm, extra=3)
      # 'extra' means the number of photos that you can upload   ^
  
      if request.method == 'POST':
          postForm = PostForm(request.POST)
          formset = ImageFormSet(request.POST, request.FILES,
                                 queryset=Images.objects.none())
  
          if postForm.is_valid() and formset.is_valid():
              post = postForm.save(commit=False)
              post.author = request.user
              post.save()
  
              for form in formset.cleaned_data:
                  # this helps to not crash if the user
                  # do not upload all the photos
                  if form:
                      image = form['image']
                      photo = Images(post=post, image=image)
                      photo.save()
  
              return redirect("index")
  
          else:
              print(postForm.errors, formset.errors)
      else:
          postForm = PostForm()
          formset = ImageFormSet(queryset=Images.objects.none())
      return render(request, "share.html", {"postForm": postForm, 'formset': formset})
  </code></pre>
  
  <p>share.html</p>
  
  <pre><code> &lt;form  method="POST" id="post-form" class="post-form js-post-form" enctype="multipart/form-data"&gt;
              {% csrf_token %}
               {{ formset.management_form }}
                  {% for form in formset %}
                      {{ form }}
                  {% endfor %} 
     &lt;/form&gt;
  </code></pre>
  
  <p>if you need, forms.py</p>
  
  <pre><code>class PostForm(forms.ModelForm):
      class Meta:
          model = Post
          fields = ["title", "content"]
  
      def __init__(self, *args, **kwargs):
          super(PostForm, self).__init__(*args, **kwargs)
          self.fields['title'].widget.attrs.update({'class': 'input'})
          self.fields['content'].widget.attrs.update({'class': 'textarea'})
  
  
  class ImageForm(forms.ModelForm):
      image = forms.ImageField(label='Image')
  
      class Meta:
          model = Images
          fields = ('image', )
  
          def __init__(self, *args, **kwargs):
              self.fields['image'].widget.attrs.update(
                  {'class': 'fileinput', 'multiple': True})
  </code></pre>
  
  <p>models.py</p>
  
  <pre><code>from django.db import models
  from django.contrib.auth.models import User
  from django.template.defaultfilters import slugify
  
  
  class Post(models.Model):
      # on_delete ile, bu kullanıcı silindiğinde bu kullanıcıya ait tüm postlar da silinecek.
      author = models.ForeignKey(
          "auth.User", on_delete=models.CASCADE, verbose_name="Yazar")
      title = models.CharField(max_length=150, verbose_name="Başlık")
      content = models.TextField(verbose_name="İçerik")
      # auto_now_add = True ile veritabanına eklendiği tarihi otomatik alacak
      created_date = models.DateTimeField(auto_now_add=True)
  
      # admin panelinde Post Object 1 yazması yerine başlığı yazsın istersek...
      def __str__(self):
          return self.title
  
  
  def get_image_filename(instance, filename):
      title = instance.post.title
      slug = slugify(title)
      return "post_images/%s-%s" % (slug, filename)
  
  
  class Images(models.Model):
      post = models.ForeignKey(
          Post, on_delete=models.DO_NOTHING, default=None)
      image = models.ImageField(upload_to=get_image_filename,
                                verbose_name='Image', default="images/default_game_img.png")
  </code></pre>