4 ms·
It's even worse: zip codes can contain letters and spaces in United Kingdom: https://en.wikipedia.org/wiki/Postcodes_in_the_United_Kingdom#Validation https://en
by silvestrov 8y ago
It's even worse: zip codes can contain letters and spaces in United Kingdom:
https://en.wikipedia.org/wiki/Postcodes_in_the_United_Kingdom#Validation https://en.wikipedia.org/wiki/Postcodes_in_the_United_Kingdo...
- kawsper 8y agoAnd they are not called zip codes.
- ubernostrum 8y agoFalsehoods programmers believe about this HN thread: it links to Django's documentation. It linked to a 13-year-old unmaintained community wiki page, and people apparently didn't look too closely at it. I stuck a big honkin' warning at the top of the page to clarify that. If you want to handle US zip codes, UK postcodes, or other country-specific data types in Django, may I suggest this, which formerly was bundled with Django and now is maintained as a separate add-on: https://django-localflavor.readthedocs.io/en/latest/ https://django-localflavor.readthedocs.io/en/latest/ It includes such things as a correct dedicated US zip code field, and a correct dedicated UK postcode field.