title: Form validation not working for adding images in django 1.11
body: <p>I have an app where i am uploading multiple images and uploading it.
  It works fine but without uploading anything if i click on upload it gives me an error because the validations are working. This is the error:</p>
  
  <pre><code>django.utils.datastructures.MultiValueDictKeyError: "'gallery'"
  </code></pre>
  
  <p>This is my code here:</p>
  
  <p>models.py</p>
  
  <pre><code>class GalleryImage(models.Model):
  
      image = models.ImageField(upload_to='uploads/obituaries', db_index=True)
      obituary = models.ForeignKey(Obituary, related_name="gallery")
  
      def __str__(self):
          return self.obituary.name
  </code></pre>
  
  <p>Views.py</p>
  
  <pre><code>class GalleryAddView(View):
      def post(self, request, slug):
          try:
              data = request.FILES['gallery']
              if len(request.FILES.getlist('gallery')) &gt; 10:
                  messages.error(request, "Max gallery images limit exceeded! Only 10 images are allowed.")
                  return HttpResponseRedirect(
                      reverse('obituary:public', kwargs={'slug': slug}))
              if request.FILES['gallery']:
                  for f in self.request.FILES.getlist('gallery'):
                      print(f)
              instance1 = Obituary.objects.get(slug=slug)
  
              if self.request.FILES:
                  for f in self.request.FILES.getlist('gallery'):
                      GalleryImage.objects.create(obituary=instance1, image=f)
              messages.success(request, "Gallery images uploaded successfully!")
              else:
                  messages.error(request, 'Please upload some images')
  
          except Obituary.DoesNotExist:
              messages.error(request, constants.OPERATION_UNSUCCESSFUL)
          return HttpResponseRedirect(reverse('obituary:public', kwargs={'slug': slug}))
  </code></pre>
  
  <p>forms.py</p>
  
  <pre><code>class GalleryForm(models.ModelForm):
  
      class Meta:
          model = GalleryImage
          fields = ['image']
  </code></pre>
  
  <p>template.html</p>
  
  <pre><code>&lt;form class="setting-form" id="create_obit" action="{% url 'obituary:gallery' obituary.slug %}" method="POST" enctype="multipart/form-data"&gt;
      {% csrf_token %}
      &lt;fieldset&gt;
           &lt;div class="col-xs-12"&gt;
           {% if gallery|length &gt; 0 %}
                   &lt;h3&gt;Upload More Gallery Photos&lt;/h3&gt;
           {% else %}
                   &lt;h3&gt;Upload Gallery Photos&lt;/h3&gt;
           {% endif %}
           &lt;div class="dropzone" id="my-awesome-dropzone"&gt;
                 &lt;div class="fallback"&gt;
                      (Maximum image size should be 8 MB)
                         &lt;input type="file" name="gallery" class="form-control input-field" id="id_user_image" accept="image/*" multiple&gt;
                &lt;/div&gt;
           &lt;/div&gt;
        &lt;/div&gt;
           &lt;div class="col-xs-12"&gt;
               &lt;div class="form-group"&gt;
                    &lt;button type="submit" id="create" class="btn send-btn" &gt;Upload&lt;/button&gt;
               &lt;/div&gt;
          &lt;/div&gt;
  &lt;/fieldset&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>I dont know where i am going wrong. </p>