Django choose in what location images are loaded in model’s save method

The problem is that the filename is updated everytime. At each step, you should make sure that the filename is only a filename. Something like this:

import os

if self.image:
    self.image = compress(self.image)
    self.image.name = os.path.basename(self.image.name)

I don’t know exactly what is your compress function, but maybe you could also check that it doesn’t do something weird with the filename.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top