On Wed, 2008-01-09 at 14:04 -0700, Brian Rosner wrote: > On 2008-01-08 18:46:02 -0700, Malcolm Tredinnick > <[EMAIL PROTECTED]> said: > > > > > > > On Tue, 2008-01-08 at 18:40 -0700, Brian Rosner wrote: > > [...] > > > >> To write a patch I created a new widget named BoundFileInput that > >> inherits from MultiWidget to display the FileInput and HiddenInput > >> widgets. The FileInput widget works the same as it does now. The > >> HiddenInput widget maintains the data that came from the model. As I > >> understand it this is how it used to work in oldforms, but perhaps just > >> the admin in trunk. > > > > I'd prefer that we worked out a way to get the initial data passed > > through. Sticking this in a hidden field would mean that you pretty much > > always have to include some kind of security hash as well to avoid the > > hidden field value being changed. This is why Russell's improvements for > > file uploading in newforms were a slightly better design. > > Ok, that makes more sense. I had a feeling I was taking the wrong > approach. I hadn't seen his proposal, perhaps I should have done a bit > more research ;) Should FileField be special cased for initial data or > make a global change to all fields?
I'd special-case FileField, since all the related field (ImageField, any custom upload fields) will be subclasses of that. More specifically, it's really keyed off the HTML widget, since it's only the file upload widget that has this particular problem. Without looking at the code, I couldn't say if it's better to do test the widget type or the formfield type, but the former is probably more robust, if you can do it. Regards, Malcolm -- Honk if you love peace and quiet. http://www.pointy-stick.com/blog/ --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
