#657 closed defect (wontfix)
validator - characters without numbers
| Reported by: | Bless | Owned by: | Adrian Holovaty |
|---|---|---|---|
| Component: | Validators | Version: | |
| Severity: | normal | Keywords: | |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
It should be a validator for characters without numbers, because is possible that you want whatever text minus numbers.
num_re = re.compile(r'\d')
def thereisNumeric:
if num_re.search(field_data):
raise ValidationError, "This value musn't contain numbers."
Change History (6)
comment:1 by , 20 years ago
| Component: | Admin interface → Validators |
|---|
comment:2 by , 20 years ago
comment:3 by , 20 years ago
| Resolution: | → wontfix |
|---|---|
| Status: | new → closed |
This is a bit too obscure for inclusion in the standard validator library, I think. Feel free to write your own validator and use it within your own code.
comment:4 by , 20 years ago
| Resolution: | wontfix |
|---|---|
| Status: | closed → reopened |
I believe that now it's more clear
num_re = re.compile(r'\d')
def isCharacterNotNumeric(field_data, all_data):
if num_re.search(field_data):
raise ValidationError, "This value must not contain numbers."
I think that it would be useful
comment:5 by , 20 years ago
I wrote wrong the raise
raise ValidationError, "This value must not contain numeric characters."
comment:6 by , 20 years ago
| Resolution: | → wontfix |
|---|---|
| Status: | reopened → closed |
adrian, you had reason. I'll use my own validator.
Note:
See TracTickets
for help on using tickets.
Examples of field data:
"foo bar" -> validators.isOnlyLetters fails by the space
"foo-bar"
"foo;bar"