#20660: Filefield.delete() on empty field delete MEDIA_ROOT --------------------------------------+------------------------------ Reporter: stanislas.guerra@… | Owner: nobody Type: Bug | Status: new Component: File uploads/storage | Version: 1.4 Severity: Normal | Keywords: FileField delete Triage Stage: Unreviewed | Has patch: 0 Easy pickings: 0 | UI/UX: 0 --------------------------------------+------------------------------ Maybe this is because I use a symlink in my Apache configuration to serve the media :
{{{ $ ls -l /var/www/mysite.domain.com/documents/ -rw-r--r-- 1 www-data www-data 474 1 févr. 15:27 maintenance.html lrwxrwxrwx 1 root root 20 26 juin 15:02 media -> /data/media_mysite drwxr-xr-x 6 myuser www-data 4096 16 mai 12:01 static $ ls -l /data/media_mysite total 8 drwxrwsr-x 3 myuser www-data 4096 13 févr. 10:13 stuffs drwxrwsr-x 3 myuser www-data 4096 13 févr. 10:00 other_stuffs }}} But when I call delete() on an ImageField, if that very field is empty, the symlink is wipped out! {{{ $ python manage.py shell In [1]: from myproject.myapp.models import MyModel In [2]: obj = MyModel.objects.get(euid="21439011") In [3]: obj.my_file Out[3]: <FieldFile: None> In [4]: obj.my_file.delete() $ ls -l /var/www/mysite.domain.com/documents/ -rw-r--r-- 1 www-data www-data 474 1 févr. 15:27 maintenance.html drwxr-xr-x 6 myproject www-data 4096 16 mai 12:01 static }}} Should not an exception be raised here instead ? -- Ticket URL: <https://code.djangoproject.com/ticket/20660> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/069.5b3ce83c5787142d9df0abb965568fb5%40djangoproject.com. For more options, visit https://groups.google.com/groups/opt_out.