def validate ( self , obj ) : if not isinstance ( obj , self . model_class ) : raise ValidationError ( 'Invalid object(%s) for service %s' % ( type ( obj ) , type ( self ) ) ) LOG . debug ( u'Object %s state: %s' , self . model_class , obj . __dict__ ) obj . full_clean ( )
"how to validate a python model"
Raises django . core . exceptions . ValidationError if any validation error exists
def validate(self, obj):
        """ Raises django.core.exceptions.ValidationError if any validation error exists """

        if not isinstance(obj, self.model_class):
            raise ValidationError('Invalid object(%s) for service %s' % (type(obj), type(self)))
        LOG.debug(u'Object %s state: %s', self.model_class, obj.__dict__)
        obj.full_clean()