I like this patch except for some issues. Files cannot be saved with different names based on other data i the model, since fields after the filefield does not set values in the model. This also causes a problem since save is called in save_FIELD_file before all values are set on the model.
Not sure how this should be fixed. Except for this +1 for me. Wrote a patch for admin intergration and solving the problem with save being called in save_FIELD_file. Made the view pass request.FILES to the form only if it is needed by a FileField, not sure if it should be passed no matter what to keep the code cleaner. Would like feedback this patch. On Jun 7, 1:36 pm, "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote: > Hi all, > > I've just uploaded a potential fix for ticket #3297 - an > implementation of FileField and ImageField for newforms - and I'm > looking for some feedback. > > Details for those interested (repeated from the description of the ticket): > > * Modifies forms to take a "files" argument, for storage of file > data. This means you no longer have to copy and update your POST > dictionary on submit. You just call MyForm?(request.POST, > request.FILES) > > * Introduces an "UploadedFile?" temporary object to store the > submitted file data. > > * Modifies the internals of the form_for_model/instance save > method to make field saving more generic, rather than making a special > case of FileField?. This should make writing custom fields with > unusual save requirements much easier. > > This patch has 2 potential backwards incompatibilities: > > 1. If you are relying upon auto_id being the 2nd argument on a form > (rather than explicitly naming auto_id=False), your rendered forms > will start adding label tags. > > 2. If you have written any custom code using value_from_datadict, > you will need to modify those implementations to handle the new files > argument. > > Yours, > Russ Magee %-) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" 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-developers?hl=en -~----------~----~----~----~------~----~------~--~---
