On 26-Dec-07, at 10:03 AM, Malcolm Tredinnick wrote:

>
>
> On Wed, 2007-12-26 at 09:46 +0530, Kenneth Gonsalves wrote:
>>
>> On 26-Dec-07, at 9:01 AM, Malcolm Tredinnick wrote:
>>
>>>
>>>
>>> On Wed, 2007-12-26 at 08:53 +0530, Kenneth Gonsalves wrote:
>>>>
>>>> On 25-Dec-07, at 7:53 PM, l5x wrote:
>>>>
>>>>> Hm, I didn't have this error with my PhotoForm. You can look at it
>>>>> here: http://groups.google.com/group/django-users/browse_thread/
>>>>> thread/6693f3294e710eab
>>>>
>>>> when you want to change the photo in the form, when the form  
>>>> comes up
>>>> is the filename of the original photo shown?
>>>
>>> What you're seeing is normal browser behaviour. They don't populate
>>> file
>>> upload fields with any kind of initial data. As Joseph mentioned,
>>> that's
>>> a special case that will need to be built into ModelForms: manually
>>> copy
>>> over the initial data before validating for file fields.
>>
>> showing the filename is a minor problem which can be solved. The
>> problem is that the file data is not sent to the form.
>
> Since the form won't send the data back, there's no point in  
> sending it
> to the form. The bug is as I explained in my previous mail: for the
> "instance" case, we need to copy the initial form data across prior to
> validating.

ok. Finally did it. A horrible hack. If not request.FILES, copy the  
initial file data into the form to fool is_valid. Then ignore the  
form and manually save whatever else has changed. If the image has  
changed, also manually delete the old image. It is working.

-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/web/
Foss Conference for the common man: http://registration.fossconf.in/web/



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to