Re: How to use ImageField to save images to dynamic path

2008-04-23 Thread PENPEN
I'm not clear how it could be. Could you please explain it in detail? Many thanks! /BRs On Apr 23, 1:34 pm, "Eric Liu" <[EMAIL PROTECTED]> wrote: > Why don't you set 'images/' as a variant.then you can change it dynamically > > 2008/4/23, Rishabh Manocha <[EMAIL PROTECTED]>: > > > > > Yea, I don

Re: How to use ImageField to save images to dynamic path

2008-04-22 Thread Eric Liu
Why don't you set 'images/' as a variant.then you can change it dynamically 2008/4/23, Rishabh Manocha <[EMAIL PROTECTED]>: > > > Yea, I don't think the method I described would work for directories > (or at-least I can't figure out how). It does, however, work if you > want to add something to a

Re: How to use ImageField to save images to dynamic path

2008-04-22 Thread Rishabh Manocha
Yea, I don't think the method I described would work for directories (or at-least I can't figure out how). It does, however, work if you want to add something to a filename before saving it. The code I use is: request.FILES['resume']['filename'] = request.POST['empid'] + "_" + request.FILES['resu

Re: How to use ImageField to save images to dynamic path

2008-04-22 Thread PENPEN
How do you mean of changing request.FILES there itself? I tried to add the directory to request.FILES but failed. Django ignored the directory and savethe image to the MEDIA_ROOT not MEDIA_ROOT/images. class Thing(models.Model): photo = models.ImageField( upload_to='images/', blank=Tr

Re: How to use ImageField to save images to dynamic path

2008-04-21 Thread Rishabh Manocha
I don't know if this answers your specific question, but this is being worked on, apparently - http://code.djangoproject.com/ticket/5361. I had a similar requirement, where I wanted to dynamically append a model field to the filename before saving it. I ended up getting the model field's value fr

How to use ImageField to save images to dynamic path

2008-04-20 Thread PENPEN
I defined such a model: class Thing(models.Model): photo = models.ImageField( upload_to='images/', blank=True, null=True) Here is the form for this model: class ThingForm(ModelForm): class Meta: model = Thing Now it could handle the image upload request and save images t