On Wed, Sep 10, 2008 at 8:13 AM, shadfc <[EMAIL PROTECTED]> wrote: > The problem is that FieldFiles get saved to the storage backend even > on a save(commit=False), and (according to a more knowledgeable SeanL- > on #django), the FieldFile will only get saved once, the first time > through. So the only way I can accomplish what I want is to do two > saves to my backend -- one when the formset is saved with commit=False > and then I must call the storage backend's save() directly in order to > upload the changes I've made to the mp3 file in memory.
Ouch. In a formset sounds like you could be calling save up to N*2 times. > I think that the commit=False (or save=False in FieldFile.save() ) > should not do the save to the storage backend. Agreed. I have been considering treating FileFields the same as many-to-many fields when commit=False in a ModelForm. In the event that commit=False a new method is available to perform the file saving explicitly. This would help in the event of wanting to name the file the same as the primary key for instance. > > Another option might be to pass the save argument along to the storage > backend and give the backend designer control over the behavior -- > perhaps to reserve a filename in a cache with a short ttl. This would > still require that the save() on FieldFile be called more than once > though. We need to avoid calling save on a file backend as much as possible. That operation may be very expensive. Go look for a ticket about this. If there isn't one I would say report one. This seems like a reasonable thing to do in general. -- Brian Rosner http://oebfare.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~----------~----~----~----~------~----~------~--~---