然后我意识到,大多数用户在编写http://‘时不会在前面加上’URL‘,然后我决定使用一种干净的方法。在检查了很多地方的URLFieldclean方法之后,我想出了这个:from rango.models import Category, Pagetitle = forms.CharField(max_length=128, help_text="Please enter the title of the page")
是否有一种方法可以将自定义错误消息添加到模型字段中,而不将其声明为表单字段?这个是可能的吗?例如,我不想再次声明字段 test = models.URLField(max_length = 200)
class Meta:是否有一种方法可以提供自定义错误消息,而无需在表单中再次定义它?forms.ModelForm):
class Meta: