Hi all,

  I spent the last 2 hours fighting with a model.FileField  that I
wanted to save the file with a custom name (job number of a hylafax
server).
  I found a related thread here: http://groups.google.com/group/django-
users/browse_frm/thread/f337faf5ef5d8f9a/3c183363b21b496d?
lnk=gst&q=file+upload+form&rnum=7&hl=en#3c183363b21b496d
  so I tried to define a save as suggested:

 def save(self):
   oldname = self.file_field
   # rename & move file to new name if needed
   self.file_field = newname
   super(Fax, self).save()

this does not work for me.
It seems save method is called twice by the generic view create_update
within the call 'manipulator.save(new_data)'. The fist time self.file
is empty the second already has the automatically generated filename.
Why is it called twice? Now I call os.rename but wich should be the
correct way to do it?

Thanks in advance
sandro
*;-)


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" 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-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to