I have a small problem with django, i'm beginner, and i would like to delete a file right before a new one is uploaded. I use this in my model.py
class Object(models.Model):
photo1 = models.ImageField('main image', upload_to='%Y/%m/%d', max_length=200)
It works well for upload, but it keep the old image on hard drive. I can do a script to delete or move to a trash directory the file, but it's a bit problematic when using the django admin interface, because it won't update as i want. Is there a good way to delete the old photo1 variable object before storing the new one? Thanks for any help! (sorry for bad english)