Re: Delete the file related on the FileField

2015-02-25 Thread Karim
On Thu, Feb 26, 2015 at 2:13 AM, Rodrigo Zayit wrote: > Hi Karim, > ​[]​ > > Thank you! -- Karim N. Gorjux -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails

Re: Delete the file related on the FileField

2015-02-25 Thread Rodrigo Zayit
Hi Karim, You can do: from django.db.models.signals import pre_delete from django.dispatch.dispatcher import receiver @receiver(pre_delete, sender=ModelName) def modelname_delete(sender, instance, **kwargs): instance.field_name.delete(False) or on your model you can write your delete

Delete the file related on the FileField

2015-02-24 Thread Karim
I'm using a form that get an image and store it in the database. Doing my (manual) tests I discover that the deleting the FileField doesn't remove the associated file on the hard disk. Is there a design pattern to handle the remaining file? Thank you. -- Karim N. Gorjux -- You received this