Could you override the save method and remove the file from the
filesystem prior to saving?

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
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to