سؤال

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?

هل كانت مفيدة؟

المحلول

Include the following at the beginning of the file -

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

This would set default encoding to Unicode.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top