title: Django Imagefield renaming works only every other time
body: <p>I'm attempting to upload a profile picture to a django model which should always be named pic.jpg. Old pictures are deleted using django_cleanup.</p>
  <p>This works every other time. I upload an image and it's saved as pic.jpg, then upload a different one and it's saved as pic_{randomchars}.jpg (i.e pic_wCU5xwv.jpg).</p>
  <pre><code>def rename_pic(instance, filename):
          return os.path.join(&quot;api/media/me/&quot;, filename)
  pic = models.ImageField(upload_to=rename_pic)
  
  def save(self, *args, **kwargs):
          try:
              # Opening the uploaded image
              img = Image.open(self.pic)
              output = BytesIO()
  
              img = img.convert('RGB')
              # after modifications, save it to the output
              img.save(output, format='JPEG')
              output.seek(0)
  
              # Set field to modified picture
              self.pic = InMemoryUploadedFile(output, 'ImageField', &quot;pic.jpg&quot;,
                                              'image/jpeg', sys.getsizeof(output), None)
          except Exception as e:
              print(e)
          print(self.pic.name)       # Always prints pic.jpg
          super(MyData, self).save() # Error happens in this line
          print(self.pic.name)       # Prints api/media/me/pic.jpg and api/media/me/pic_{randomchars}.jpg alternating
  </code></pre>
  <p>The error happens somewhere in the <code>super(MyData, self).save()</code> line, as the file has the correct name before it's called.</p>