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