python - ValidationError giving me exception -
my admin:
from django.core.exceptions import validationerror def save_model(self, request, obj, form, change): if obj.foo == true , obj.bar == '': raise validationerror('please enter password.')
my model is:
foo = models.booleanfield(default=false) bar = models.charfield(max_length=50, null=true, blank=true)
i want validate models when foo
true bar
can't null. giving me 500. exception value: [u'please enter password.']
you're supposed validation in modelform
, not modeladmin
.
Comments
Post a Comment