#30811: Django throws 'UnicodeEncodeError' when using Cyrillic symbols to 
override
field upload_to.
-------------------------------------+-------------------------------------
     Reporter:  Kirill               |                    Owner:  Kirill
         Type:  Bug                  |                   Status:  closed
    Component:  Database layer       |                  Version:  master
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:  invalid
     Keywords:  UnicodeEncodeError,  |             Triage Stage:
  Cyrillic, upload_to, File,         |  Unreviewed
  FileField                          |
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by felixxm):

 * status:  assigned => closed
 * version:  2.2 => master
 * resolution:   => invalid


Comment:

 Thanks for this report, however I don't think that it is an issue in
 Django, but rather in your implementation if you want to set `upload_to`
 dynamically you should set it to a callable, e.g.
 {{{

 def callable_upload_to(instance, filename):
     return posixpath.join(instance.title, filename)

 class Book(models.Model):
     pdf = FileField(..., upload_to=callable_upload_to)
     ...
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/30811#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.fda568b8cf587b4e30c5bd8caafda851%40djangoproject.com.

Reply via email to