djangosnippets.org: Latest snippets posted by timonwebhttps://djangosnippets.org/users/timonweb/2012-05-07T08:45:54.766494-05:00timonwebREMOVE IMAGEFIELD ATTACHMENT IN DJANGO
2012-05-07T08:45:54.766494-05:00timonwebhttps://djangosnippets.org/snippets/2744/<p>File cleanup callback used to emulate the old delete
behavior using signals. Initially django deleted linked
files when an object containing a File/ImageField was deleted.</p>
<pre><code>Usage:
>>> from django.db.models.signals import post_delete
>>> post_delete.connect(file_cleanup, sender=MyModel, dispatch_uid="mymodel.file_cleanup")
</code></pre>
Freely redistributable