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

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -