Re: how to validate not blank field?

2007-09-10 Thread Nis Jørgensen
[EMAIL PROTECTED] skrev: > thanks for your reply! i resolved using this code in the models.py > before save(): def save(self): if len(self.title)<6: raise > ValidationError("cannot be blank or small than 6 byte!") it works for > me! > > but i find this code in django-tagging (http://code.google.co

Re: how to validate not blank field?

2007-09-10 Thread [EMAIL PROTECTED]
thanks for your reply! i resolved using this code in the models.py before save(): def save(self): if len(self.title)<6: raise ValidationError("cannot be blank or small than 6 byte!") it works for me! but i find this code in django-tagging (http://code.go

Re: how to validate not blank field?

2007-09-10 Thread Nis Jørgensen
[EMAIL PROTECTED] skrev: > i used this: def isBlank(field,all_data): if field_data is None: > raise ValidattionError(u'Cannot be Blank.') > > it not work for me. It seems you are being bitten by the behavior described thus in the documentation: """ After a form has been submitted, Django validate

Re: how to validate not blank field?

2007-09-07 Thread [EMAIL PROTECTED]
in django-tagging, i found: class Tag(models.Model): """ A basic tag. """ name = models.CharField(max_length=50, unique=True, db_index=True, validator_list=[isTag]) objects = TagManager() content from validator.py: def isTag(field_data, all_data): """ Validates that

how to validate not blank field?

2007-09-07 Thread [EMAIL PROTECTED]
i used this: def isBlank(field,all_data): if field_data is None: raise ValidattionError(u'Cannot be Blank.') it not work for me. should i use if field_data is Blank? do someone know how to raise a error when the fields is blank? thx --~--~-~--~~~