title: Optional image input field's kicking me out of session
body: <p>This problem has been puzzling me for few hours now. I'm designing an
  update profile page where user can update photo if user wishes.</p>
  
  <p>The problem is that when I leave the image input field blank and edit other fields and hit submit, nothing is changed and I get kicked out of session, on the other hand when I select an image to upload and hit submit everything is updated and function runs as I designed it.</p>
  
  <p>Here's relevant code:</p>
  
  <pre><code>class User(models.Model):
      photo  = models.CharField(max_length=100, null=False, blank=True)
  </code></pre>
  
  <p>It's a Charfield 'coz I store only reference to the image in database.</p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;input type="file" name='photo' class="form-control"&gt;
  </code></pre>
  
  <p>View:</p>
  
  <pre><code>if request.method == 'POST':
  
       photo = request.FILES['photo']
       if photo:
           fs = FileSystemStorage()
           filename = fs.save(photo.name, photo)
           uploaded_file_url = fs.url(filename)
           if uploaded_file_url[-4:] not in ALLOWED_EXTENSIONS:
                 error = 'Invalid File Type'
                 errors.append(error)
  
       print(uploaded_file_url)
  </code></pre>
  
  <p>You can ignore the print statement. I spread bunch of those all over the this function so I can see how the function works at each stage. Thanks to this I was able to determine that when the file input field is left blank other code is no longer being processed and program exits out. But clearly the field is supposedly optional. I checked the indentation too. Making my head in.</p>
  
  <p>Any thoughts ?</p>