Saturday, March 30, 2013

FileField delete and update handling

Hi,

As it seems Django doesn't handle the update and delete of files from a FileField by itself leaving you them pretty hard to use by default.

I tried search around but couldn't find a proper answer as to the correct way of handling this.

I'm looking for the case where when the file is updated to a new name or deleted, it will be deleted properly from the file system, preferably not leaving empty directories too.

Not having this done at the model level means all the generic views and admin pages are useless and require customization to delete and update the file name in them.

The other option is a script that is going to iterate the entire directory and look for files not listed in the db, which is a really expensive and slow operation.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment