class Article(Model.model):
title = ''
title_hash = hash(title)
保存title时自动生成title_hash
class Article(Model.model):
title = ''
title_hash = hash(title)
保存title时自动生成title_hash
def save_title_hash(self):
title_hash = hash(title)
return title_hash
title_hash = property(save_title_hash)
在model重写save 方法
大概是这样: