我有这个在我的views.py
response_dict = {
'status': status,
'message': message
}
return HttpResponse(simplejson.dumps(response_dict),
mimetype='application/javascript')
自从我开始使用这个导入:
from django.utils.translation import ugettext_lazy as _
在这一行:
message = _('This is a test message')
我收到此错误:
File "/home/chris/work/project/prokject/main/views.py", line 830, in fooFunc
return HttpResponse(simplejson.dumps(response_dict),
File "/usr/local/lib/python2.7/json/__init__.py", line 243, in dumps
return _default_encoder.encode(obj)
File "/usr/local/lib/python2.7/json/encoder.py", line 207, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/usr/local/lib/python2.7/json/encoder.py", line 270, in iterencode
return _iterencode(o, 0)
File "/usr/local/lib/python2.7/json/encoder.py", line 184, in default
raise TypeError(repr(o) + " is not JSON serializable")
TypeError: <django.utils.functional.__proxy__ object at 0x7f42d581b590> is not JSON serializable
为什么?我究竟做错了什么?