在python3中,只能用 def__str__()。 def unicode()不起作用
在python2中, def__str__()、 def unicode()都能用
官方说,def unicode()是更安全的访问值
参考:
https://segmentfault.com/q/1010000006121303?_ea=1020085
https://stackoverflow.com/questions/31412964/unicode-self-for-python3-and-django1-8-not-working
网友评论