> 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 > > e.g. > > class MyModel(models.Model): > ... > > def save(self): > if self.id: # is a record in the database > # file system unlink call to self.path > super(MyModel, self).save() > > -Rob > > On Jul 9, 6:22 am, pihentagy <[EMAIL PROTECTED]> wrote: >> Hi all! >> >> Is it possible to access a model object's saved field values? >> Purpose: >> I have an ImageField, and if that field changes, I would like to >> remove the old file from the filesystem. Now the only way to figure it >> out is with a new query, but I suspect this hits the database again, >> and seems a bit hacky BTW. >> >> thanks >> Gergo -- EB White - "Be obscure clearly." --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---