On Nov 14, 9:31 pm, Javier <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I've create a model:
>
> class ImagenesLugar(models.Model):
>     archivo = models.ImageField(upload_to="imageneslugar/")
>     texto = models.CharField(max_length=400)
>
> The thing is that when i create a new instance of this model and
> assign instance.archivo to a file then instance.archivo.path does not
> contain my upload_to parameter:
>
> Ie:
>
> my media root is :"/home/media"
> my uploadto is "imageneslugar"
> my file is "image.jpg"
>
> I do:
> instance.archivo = "image.jpg"

Is this pseudo code or does that actually work? I do this:
instance.achivo.save('image.jpg', request.FILES['photo'])

>
> then:
> instance.archivo.path is:
> /home/media/image.jpg
> instead of
> /home/media/imageneslugar/image.jpg
>
> what am I missing?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to