#7048: Support clearing FileFields in the admin if blank=True
-------------------------------------------+--------------------------------
          Reporter:  jarrow                |         Owner:  jarrow  
            Status:  new                   |     Milestone:  post-1.0
         Component:  django.contrib.admin  |       Version:  SVN     
        Resolution:                        |      Keywords:          
             Stage:  Accepted              |     Has_patch:  1       
        Needs_docs:  0                     |   Needs_tests:  1       
Needs_better_patch:  0                     |  
-------------------------------------------+--------------------------------
Comment (by jarrow):

 With the current default values for the ModelForm Meta class options the
 admin shows the delete checkbox and removes the file from disk. It does
 not remove empty directories. To enable this in the admin one currently
 needs to do something like this:

 {{{
 #!python
 class TestModelAdmin(admin.ModelAdmin):
     def get_form(self, request, obj=None, **kwargs):
         defaults = {
             "files_delete_empty_dirs": True,
         }
         defaults.update(kwargs)
         return super(TestModelAdmin, self).get_form(request, obj,
 **defaults)
 }}}

 Maybe a settings option to make deletion of empty dirs the default would
 be nice. Or we could add a files_delete_empty_dirs option to the
 ModelAdmin class and pass it to the ModelForm (like we do with exclude
 etc.).

-- 
Ticket URL: <http://code.djangoproject.com/ticket/7048#comment:19>
Django <http://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 post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to