Django

Code

Ticket #3597: unicodedecodenewormsforms.diff

File unicodedecodenewormsforms.diff, 0.7 kB (added by Georgi Stanojevski <glisha gmail com>, 2 years ago)

It replaces str with unicode when called on RadioSelect? widgets

  • forms.py

    old new  
    227227        value = self.as_widget(self.field.widget) 
    228228        if not isinstance(value, basestring): 
    229229            # Some Widget render() methods -- notably RadioSelect -- return a 
    230             # "special" object rather than a string. Call the __str__() on that 
     230            # "special" object rather than a string. Call the __unicode__() on that 
    231231            # object to get its rendered value. 
    232             value = value.__str__() 
     232            value = value.__unicode__() 
    233233        return value 
    234234 
    235235    def _errors(self):