On 6/7/07, grahamu <[EMAIL PROTECTED]> wrote: > > Russ, > Perhaps you are correct. I am using 5335 patched with #3297, but guess > I just don't know how to code (or name?) the necessary method.
You shouldn't need to code or name anything. When you save the form, the file should be saved into the named upload directory. > Problems I have are threefold: > 1. With either type of save I cannot seem to override the 'upload_to' > location string before the file contents are saved. This can't be done with the #3297 patch. It's arguable whether it is a good idea at all. It certainly isn't a form issue - it's a model issue. The difficulty with changing the location is determining where to look for the file later. Your best bet would be to subclass models.FileField to provide an alternate implementation for get_directory_name(). > 2. If a file with the same name already exists in the appropriate > 'upload_to' location, I want to delete that file prior to saving the > new file. You need to call x.delete_input_file_file() (where x is an instance of ToolRun) > 3. I really don't want the 'upload_to' path prepended to the filename > stored in 'input_file' in the ToolRun instance. Again, this isn't a form issue - it's the behaviour of Django model fields. See previous comments on subclassing models.FileField > This has no effect on where the uploaded files are stored. I No. There isn't any magic connecting the stored name of the file and the file itself. If you change the stored name of the file, the actual file won't be moved. > def save_input_file_file(filename, raw_contents): > # save it in the correct subdir > .... > > According to the debugger, this function is never called. No, it won't be. Your provided definition will be overwritten by the version of the method installed by the model metaclass. Yours, Russ Magee %-) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---