Re: FileField uploading into an user-specific path

2009-04-29 Thread Julián C . Pérez
OMG! excellent, kevin... just what i wanted! works smooth and nice thanks a lot ;) On Apr 29, 12:42 pm, Kevin Audleman wrote: > You're in luck, I just programmed this exact thing: > > Define the following function right above your model: > > def

Re: FileField uploading into an user-specific path

2009-04-29 Thread Kevin Audleman
You're in luck, I just programmed this exact thing: Define the following function right above your model: def upload_location(instance, filename): return 'profile_photos/%s/%s' % (instance.user.username, filename) My function uses 'profile_photos' as the base directory appended to

Re: FileField uploading into an user-specific path

2009-04-29 Thread Julián C . Pérez
thanks... but... how can i make that attribute a callable tto work with user-specif paths?? On 29 abr, 03:18, Kip Parker wrote: > upload_to can be a callable > -http://docs.djangoproject.com/en/dev/ref/models/fields/#filefield. > > On Apr 29, 4:59 am, "Carlos A. Carnero

Re: FileField uploading into an user-specific path

2009-04-29 Thread Kip Parker
upload_to can be a callable - http://docs.djangoproject.com/en/dev/ref/models/fields/#filefield. On Apr 29, 4:59 am, "Carlos A. Carnero Delgado" wrote: > Oops, too quick to press reply :o > > On Tue, Apr 28, 2009 at 11:53 PM, Carlos A. Carnero Delgado > >

Re: FileField uploading into an user-specific path

2009-04-28 Thread Carlos A. Carnero Delgado
Oops, too quick to press reply :o On Tue, Apr 28, 2009 at 11:53 PM, Carlos A. Carnero Delgado > destination_file = open('somewhere based on the user', 'wb+') >  for chunk in request.FILES['audio_file'].chunks(): >      destination_file.write(chunk) >  destination_file.close() with this method

Re: FileField uploading into an user-specific path

2009-04-28 Thread Carlos A. Carnero Delgado
Hello, 2009/4/28 Julián C. Pérez : > > anyone?? > how can i make that happen?? What's wrong with having something like the following in the view that processes the form? destination_file = open('somewhere based on the user', 'wb+') for chunk in

Re: FileField uploading into an user-specific path

2009-04-28 Thread Julián C . Pérez
ok, you're right... sorry for the rush i can wait ;) On Apr 28, 8:12 pm, Russell Keith-Magee wrote: > 2009/4/29 Julián C. Pérez : > > > > > anyone?? > > how can i make that happen?? > > You asked your original question 4 hours ago. This is an

Re: FileField uploading into an user-specific path

2009-04-28 Thread Russell Keith-Magee
2009/4/29 Julián C. Pérez : > > anyone?? > how can i make that happen?? You asked your original question 4 hours ago. This is an international mailing list. Many of the audience for your message are asleep. Please show some patience. If you have a more immediate need please

Re: FileField uploading into an user-specific path

2009-04-28 Thread Julián C . Pérez
anyone?? how can i make that happen?? On Apr 28, 3:41 pm, Julián C. Pérez wrote: > hi u all > i'm progressing in my django wisdom jeje > but everyday i face new challenges and/or problems... > 'im working on a uploading files application... > and i want to store every uploaded

FileField uploading into an user-specific path

2009-04-28 Thread Julián C . Pérez
hi u all i'm progressing in my django wisdom jeje but everyday i face new challenges and/or problems... 'im working on a uploading files application... and i want to store every uploaded file into its right path, arranged by username example... if a user called 'user123' uploads a file from a