總是自動(dòng)命名Topic object(x),掩蓋Topic模型中text內(nèi)容,十分不方便。有沒有方法將Topic object的名字命名為Topic內(nèi)text內(nèi)容(或部分內(nèi)容)。謝謝!書上代碼:
class?Topic(models.Model):
????"""用戶學(xué)習(xí)的主題"""
????text?=?models.CharField(max_length=200)
????date_add?=?models.DateTimeField(auto_now_add=True)
??
????def?_str_(self):
????????"""返回模型的字符串表示"""
????????return?self.text
添加回答
舉報(bào)
0/150
提交
取消