To add more detail: The db version of the file won't be removed until the save method is complete.
def save(self): if self.id: #The photo currently exists m = MyModel.objects.get(pk=self.id) if m.photo == self.photo: #They are the same photo else: #They are not the same photo I hope this helps. On Jul 9, 8:04 am, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Wed, 2008-07-09 at 17:02 +0200, KONTRA, Gergely wrote: > > > Could you override the save method and remove the file from the > > > filesystem prior to saving? > > > That's what I'm attempting to. > > BUT: > > the question is: how can I figure out the database-saved value of the photo > > > class MyModel(models.Model): > > photo = ImageField(upload_to='temp') > > def save(self): > > if self.id: > > # now self.photo points to the requested image being > > uploaded in the admin, not the previously saved one > > You'll have to ask the database for the previous value. Django doesn't > store the "changed value" like this. One day, maybe. Right now, no. > > Regards, > Malcolm --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---