Hello django developers. Currently, FIleField and ImageField store file-system-safe file name. Imagine, if user upload a file named ééééé.txt. Yes, File-system-safe file name is .txt or _.txt. It's not special case in Japan.
I know Django says non dynamic contents should be served via apache-ish server.
But the other hand. Some client says file must have original name.
So, I make FileField and ImageField to have their original file name
like ImageField's width_field, height_field.
And if original_filename_field is specified, Field encodes and stores
file name as punycode.
eg. input développement image.jpg:
Field stores it dveloppement-image-kwa33c.jpg
original_filename_field stores it développement image.jpg
And I make file download generic view that uses original file name
if Field has original file name attribute.
attention: patch encoding is utf8.
usage:
class TestModel(models.Model):
afile = models.FileField(upload_to='afile',original_filename_field='orgname')
orgname = models.CharField(blank=True, maxlength=100)
class Admin:
pass
(r'^file/(?P<object_id>.*)/$','django.views.generic.simple.file_download', \
dict(queryset=TestModel.objects.all(),file_field='afile')),
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---
filefield_and_dlgv.diff
Description: Binary data
