I tried some tricks to get this working as I think it should to keep backwards compatibility for those with special file naming requirements.
Please give some feedback and tell me if i'm way off course. :) On Jul 16, 3:42 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Russel, any ideas on handling the fields with a custom save method > later than regular fields? > > Like doing a second for loop over the fields that have a custom save > method, or has a attribute that says it should be handled later. > > So a model object can be saved in the save handler and have a pk, and > foreignkeys/slugs before those spechial case save handlers are called. > > On Jun 12, 1:05 pm, "[EMAIL PROTECTED]" > > <[EMAIL PROTECTED]> wrote: > > 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 thefilefielddoes 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 > > aFileField, 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 ofFileFieldand 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 ofFileField?. 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 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 -~----------~----~----~----~------~----~------~--~---