【发布时间】:2010-12-05 15:20:01
【问题描述】:
def clean_title(self):
title = self.cleaned_data['title']
if len(title) < 5:
raise forms.ValidationError("Please write more in Title.")
return title
在我的 models.py 中,这通常是我在标题中设置错误的方式。
但是,如果我想在views.py 中这样做呢?我想设置这样的错误,除了我的代码逻辑。
【问题讨论】: