#3924: Caught an exception while rendering: 'ascii' codec can't decode byte 0xc3
in position 8: ordinal not in range(128)
--------------------------------------------+-------------------------------
          Reporter:  [email protected]  |         Owner:  hugo
            Status:  reopened               |     Milestone:      
         Component:  django.contrib.admin   |       Version:  1.0 
        Resolution:                         |      Keywords:      
             Stage:  Accepted               |     Has_patch:  0   
        Needs_docs:  0                      |   Needs_tests:  0   
Needs_better_patch:  0                      |  
--------------------------------------------+-------------------------------
Changes (by gnudiff):

  * status:  closed => reopened
  * resolution:  fixed =>
  * version:  SVN => 1.0
  * component:  Template system => django.contrib.admin

Comment:

 I can confirm the same error as of today, Django 1.0.2 final.

 The error seems to occur when admin interface has to return string
 representation of a foreign key, such as:

 {{{
 class Visitor(models.Model):
     firstName = models.CharField(max_length=60,help_text="Vārds")
     lastName = models.CharField(max_length=60,help_text="Uzvārds")

     def __unicode__(self):
         return "%s %s" % (self.lastName,self.firstName)
 ####
 class Visit(models.Model):
     visitor = models.ForeignKey(Visitor, help_text="Pacients")
     visitDate = models.DateTimeField(help_text="Pieteiktais laiks")

     def __unicode__(self):
         return "%s @ %s" % (self.visitor,self.visitDate.isoformat())

 }}}

 In this case, if you have Visitor with nonascii chars in name, you will be
 able to see him in admin interface fine, but as soon as you try to add a
 Visit for him and then try to access the list of all Visits, you will get
 an error of the following type.


 {{{
 Request URL:    http://127.0.0.1:8000/admin/callregister/visit/add/
 Exception Type:         DjangoUnicodeDecodeError
 Exception Value:

 'ascii' codec can't decode byte 0xc5 in position 0: ordinal not in
 range(128). You passed in <Visit: [Bad Unicode data]> (<class
 'prs.callregister.models.Visit'>)

 Exception Location:     C:\Python25\lib\site-
 packages\django\utils\encoding.py in force_unicode, line 70
 Python Executable:      C:\Python25\python.exe
 Python Version:         2.5.0

 }}}

-- 
Ticket URL: <http://code.djangoproject.com/ticket/3924#comment:26>
Django <http://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 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-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to