[patch] Some shortcomings of the PhoneNumberField
|Reported by:||Owned by:||nobody|
|Cc:||Triage Stage:||Design decision needed|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
The PhoneNumberField type is not terribly useful as shipped:
- It really should be called USPhoneNumberField since it won't accept international numbers, and outside of the US where numbers are 10 digits long they don't necessarily group them 3+3+4
- The underlying database field stores 20 characters, but the admin web interface only lets me type in 12 (which admittedly is all the validator will currently accept anyhow)
- The validator only accepts numbers in the exact form xxx-xxx-xxxx whereas other formats and separators are as common or more so in general use: (nnn) nnn-nnnn or 1-800-BISNESS are the main examples that come to mind.
I can't fix the first problem -- creating code that will recognize all national phone number formats is not really feasible, and I'm assuming that renaming the field type is also probably not possible at this stage. However I do have a short patch I will attach to this ticket that fixes the other two issues:
- Increases the length and maxlength of the form fields to the size of the underlying database
- Permit additional number formats to be entered such as the ones shown above.
Hope it's useful,
Change History (8)
comment:1 Changed 11 years ago by
|Summary:||Some shortcomings of the PhoneNumberField → [patch] Some shortcomings of the PhoneNumberField|