django增加数据显示别名

django添加数据显示别名,在python3 和2

中不同,需要在设计表中添加如下:

python3 :

def __str__(self):
    data = self.city + ' ' + self.area
    return  data

python2:

def __unicode__(self):
    return self.title

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-03-02
  • 2022-01-09
  • 2021-10-04
  • 2022-12-23
  • 2022-01-11
  • 2021-11-13
猜你喜欢
  • 2021-04-12
  • 2021-09-11
  • 2022-12-23
  • 2022-12-23
  • 2021-04-14
  • 2022-12-23
  • 2021-04-09
相关资源
相似解决方案