Hola, I'm searching without much luck and can't see the answer in the docs.
Am wanting to override the is_valid() method on a model (I think that's what I want). Basically, I have a choices field, and if one of those choices is selected, then I want a description field to be not blank/not the empty string. If it's the other two choices, I want the description field to be blank/empty string. First, I override is_valid() as a model method? Second, how do I return a false from is_valid()? ie, this is a rough up of what I'm looking for - what goes in place of return FALSE/TRUE? def is_valid(self): if enrolment.mark == 'W': #student has withdrawn from course -if enrolment.withdrawal_reason == '': #must have reason --return FALSE elif enrolment.withdrawal.reason != "": #ie, since enrolment.mark isn't 'W', confirm that the enrolment.reason is "" -return FALSE else: -return TRUE Cheers L. -- ...we look at the present day through a rear-view mirror. This is something Marshall McLuhan said back in the Sixties, when the world was in the grip of authentic-seeming future narratives. He said, “We look at the present through a rear-view mirror. We march backwards into the future.” http://www.warrenellis.com/?p=14314 -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.