Re: How do I rename a FileField() that's attached to a model?

2010-03-14 Thread Karen Tracey
On Sun, Mar 14, 2010 at 2:19 AM, Jumpfroggy wrote: > Who do I talk to about possibly contributing to the docs? > Contributing to the docs is handled just like contributing to the code. They are all in SVN, under a docs directory in the trunk. See

Re: How do I rename a FileField() that's attached to a model?

2010-03-13 Thread Jumpfroggy
Yes, it was that easy. I don't know why, but I've been banging my head against the wall on this for a while and never thought of this solution. One thing that would really help a ton is more/better examples about file-handling in django. I've spent more hours on this single feature reading &

Re: How do I rename a FileField() that's attached to a model?

2010-03-13 Thread Jumpfroggy
> you could do it manually. first use os.rename to rename the file on the disk, > and then update your model instance with the new name and save it. I think this is what I'm missing. What's the code for this? Can I just do: os.rename(model.file1.name, new_filename)

Re: How do I rename a FileField() that's attached to a model?

2010-03-13 Thread Kenneth Gonsalves
On Sunday 14 Mar 2010 7:25:08 am Jumpfroggy wrote: > But I want to rename the file on the filesystem. I want something > like this: > > model.file1.rename(new_filename) > you could do it manually. first use os.rename to rename the file on the disk, and then update your model instance

How do I rename a FileField() that's attached to a model?

2010-03-13 Thread Jumpfroggy
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