On Mon, Mar 2, 2009 at 4:47 PM, James <ja...@icionline.ca> wrote:

>
> So I added a custom storage class to an ImageField which overwrites
> files with the same name.
>
> I noticed while testing that I can add many records all referencing
> the same single image, which gets overwritten with each new record
> created.  What's strange/interesting is... the image file doesn't get
> deleted until I remove the last record referencing the file!
>
> Is django really this smart?  :)
>
> Storage class:
> http://www.djangosnippets.org/snippets/976/
>
> >
>
Yep, here's the code that makes it handle:
http://code.djangoproject.com/browser/django/trunk/django/db/models/fields/files.py#L195this
get's registered as a post_delete signal on any model that has a
filefield.

Alex

-- 
"I disapprove of what you say, but I will defend to the death your right to
say it." --Voltaire
"The people's good is the highest law."--Cicero

--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to