0
我的管理员:ValidationError给我例外
from django.core.exceptions import ValidationError
def save_model(self, request, obj, form, change):
if obj.foo == True and obj.bar == '':
raise ValidationError('Please enter the password.')
我的模式是:
foo = models.BooleanField(default=False)
bar = models.CharField(max_length=50, null=True, blank=True)
我想验证时foo
是真正的bar
不能为空的模型。但它是给我的500. Exception Value: [u'Please enter the password.']
嗯,这就是你要告诉它做的。 – 2010-12-02 07:49:17