I've gone through the documentation a ton, been trying different techniques, and I know I'm just missing something obvious.
I have a model like this: class MyModel(Model): file1 = FileField(...) So I can do this: model = MyModel.objects.get(id=1) print mode.file1.name But I want to rename the file on the filesystem. I want something like this: model.file1.rename(new_filename) But that doesn't exist. The closest I can find is somethig like this: contents = model.file1.read() model.file1.delete() model.file1.save(new_filename, contents) But this gives an exception since the FileField save() method requires a "contents" parameter that has a ".chunks()" method. Right now it's just a string. I can't use a python tempfile.TemporaryFile() object, since that then gives the exception "Unable to determine the file's size". All of this seems like I'm jumping through hoops that don't make sense. How do I just rename the file? Is there an easier way? Thanks so much! -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.