def validate_int ( value ) : if value and not isinstance ( value , int ) : try : int ( str ( value ) ) except ( TypeError , ValueError ) : raise ValidationError ( 'not a valid number' ) return value
python validate is integer
Integer validator
def validate_int(value):
    """ Integer validator """

    if value and not isinstance(value, int):
        try:
            int(str(value))
        except (TypeError, ValueError):
            raise ValidationError('not a valid number')
    return value