at_yasu's blog

ロード的なことを

__str__ と __unicode__ と Python3

いちおう、Django1.5から(だっけ?忘れた)はPython3対応をうたってるけど、__str__ と __unicode__ があってそれの対応方法

デコレ

from django.utils.encoding import python_2_unicode_compatible 
@python_2_unicode_compatible 
class Room (models.Model): 
  def __str__ (self): return self
  # def __unicode__ (self): return self # これが有効になっているとエラーを出す