Okay I think I will do both though, since I prefer not to have special
wierd chars in my url's and filenames.

So I think I will
1. take contact to my hosting provider for correct setup.
2. use a filter function that removes special chars from the uploaded
file's filenames

I attempted to write that filter function for use in my models.py and
here it is:

def upload_to(path, attribute):
    #removes special chars from filenames being uploaded, and can also
be used for seo purposes etc. to order images into special dirs
    def upload_callback(instance, filename):
        if attribute == '':
            #e.g.: image = models.ImageField(upload_to =
upload_to('uploads/', ''))
            return '%s/%s' % (path, unicode(slugify(filename)))
        else:
            #e.g.:
            #title = models.CharField(max_length=25)
            #image = models.ImageField(upload_to =
upload_to('uploads/', 'title'))
            return '%s%s/%s' % (path,
unicode(slugify(getattr(instance, attribute))),
unicode(slugify(filename)))
    return upload_callback


Please give me feedback :o)
Will that work?

Michael



On 15 Jun., 14:22, Karen Tracey <kmtra...@gmail.com> wrote:
> You could use that as a workaround, but I would not call that the right
> answer. The right answer is for the environment of the web server to be set
> up so that unicode strings containing non-ASCII data can be successfully
> passed to Python file system functions.
>
> Karen
> --http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to