Re: Testing if a file has changed while saving the class

2010-03-10 Thread Beres Botond
Just a quick idea off the top of my head before going to bed :) def save(self, *args, **kwargs): super(MyModel, self).save(*args, **kwargs) # Call the "real" save() method. timestamp = os.path.getmtime(self.my_image_field.path) if datetime.datetime.now() - timestamp < VERY_

Testing if a file has changed while saving the class

2010-03-09 Thread Xavier Ordoquy
Hi, I have a class with an image field. Every time the image is changed, I need to resize the image to several formats. At the moment, I do that every time the class which contains the image is saved. However, I'd like to improve that a bit and only resize whenever the image has changed. Is ther