On Sat, 2007-03-10 at 14:41 +0000, shevken wrote:
> Hi All,
> 
> Is there a way to change the default path of the image to use
> backslash (/../) instead of the forward slash?

Firstly, you've got back- and forward-slash reversed: a backslash is '\'
and a forward slash is '/'. Best we all use the same terminology or it's
going to get really confusing. :-)

> 
> I declared the following in my model
> 
> img = models.ImageUpload(upload_to='upload/img/')
> 
> but in the database the column's value is saved as upload\img
> \django.jpg
> 
> When i display the image,
> 
> <img src="/res/upload\img\django.jpg">

This looks like you are trying to construct the URL yourself and so it's
not coming out cleanly. You should be using the get_img_url() method
that is automatically inserted into your class for exactly this purpose.
That method knows to accommodate for backslashes being used in path
names on Windows and makes it all come out cleanly.

See [1] for the documentation on this (and some other nice methods you
have available for image and file fields). Note that in that
documentation, FOO is used as a stand-in for the name of the field.

[1] http://www.djangoproject.com/documentation/db_api/#get-foo-url

Regards,
Malcolm


--~--~---------~--~----~------------~-------~--~----~
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