Question

I trying to create a new django app with tastypie api support.

I have created a model:

class Lead(models.Model): 

    BERUFSSTATUS = (
        ("Rentner/-in", "Rentner/-in"),
        ("Schüler/-in", "Schüler/-in"),
    )

    employmentstatus = models.CharField(max_length=50, blank=False, choices=BERUFSSTATUS)

The problem is, I trying to insert

"employmentstatus":"Schüler/-in"

I get this error:

 "Value u'Sch\\xfcler/-in' is not in list."

How to fix this?

Was it helpful?

Solution

Include the following at the beginning of the file -

import sys
reload(sys)
sys.setdefaultencoding('utf-8')

This would set default encoding to Unicode.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top