Django – TypeError – save() got an unexpected keyword argument ‘force_insert’

When you are overriding model’s save method in Django, you should also pass *args and **kwargs to overridden method. this code may work fine:

def save(self, *args, **kwargs):
    super(Profile, self).save(*args, **kwargs)

    img = Image.open(self.image.path)

    if img.height > 300 or img.width > 300:
        output_size = (300,300)
        img.thumbnail(output_size)
        img.save(self.image.path)'

Leave a Comment