class CMSImageField(models.ImageField):

    def pre_save(self, model_instance, add):
        file = super(models.FileField, self).pre_save(model_instance, add)
if file and not file._committed:
    file.save('%s.png' % model_instance.pk, file, save=False)
return file
Python Django: How to upload a file with a filename based on instance pk