Numeric fields, like zip code, usually has characters other than numbers when edited in a form. When they are submitted to backend, you need to sanitize them, ignoring non-numeric chars. This is what this validator makes. Put it inside a module and import it, or put inside your models dir and just use it.
0
rochacbruno 11 years ago
Is it really needed to have the __init__ method? I did not tested, but, the init is doing nothing.
requires=CLEANUP_JUST_NUMBERS() will create an object without the need to pass any argument.
Also I never created a subclass of Validator. I always use just "object" and it works. There is some advantage on subclassing Validator?
BTW: Thanks for the slice!
replies (1)