Code

Opened 4 years ago

Closed 18 months ago

#14015 closed New feature (invalid)

django.contrib.localflavor.it added italian phone number validation

Reported by: VoodooChile Owned by: nobody
Component: contrib.localflavor Version: 1.2
Severity: Normal Keywords: django.contrib.localflavor.it, ITPhoneNumberField, form, phone, number, validation, localflavorsplit
Cc: andrea@… Triage Stage: Accepted
Has patch: yes Needs documentation: yes
Needs tests: yes Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

Hi to all,
I found myself in need of an Italian phone numbers validator, so I wrote it as a localflavor element, and now I'm sharing it with the community of Django.
The validation process is quite simple but yet very functional. The (eventual) international prefix (both +39 or 0039) is stripped from the number entered (something like 0039 010 1234567 -> 010 1234567).
The local prefix (in example 010, the prefix for Genoa) is checked against a list of valid prefixes (both fixed line or mobile), and if the number meet all the requirements (containing only number, having a prefix between 2 and 4 digits, and a number itself between 5 and 8 digits...) is returned as a cleaned value.

Hope of being of some Help,
Greetings,
Andrea

Attachments (1)

django.contrib.localflavor.it.tar.gz (3.6 KB) - added by VoodooChile 4 years ago.

Download all attachments as: .zip

Change History (7)

Changed 4 years ago by VoodooChile

comment:1 Changed 3 years ago by russellm

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 3 years ago by julien

  • Needs documentation set
  • Needs tests set
  • Patch needs improvement set
  • Severity set to Normal
  • Type set to Uncategorized

Could you please provide a diff patch instead of the whole files? It'd be great if you could also write some doc, and some tests either in source:django/trunk/tests/regressiontests/localflavor or source:django/trunk/tests/regressiontests/forms/localflavor ?

comment:3 Changed 3 years ago by julien

  • Type changed from Uncategorized to New feature

comment:4 Changed 2 years ago by aaugustin

  • UI/UX unset

Change UI/UX from NULL to False.

comment:5 Changed 2 years ago by aaugustin

  • Easy pickings unset

Change Easy pickings from NULL to False.

comment:6 Changed 18 months ago by aaugustin

  • Keywords django.contrib.localflavor.it, ITPhoneNumberField, form, phone, number, validation, localflavorsplit added; django.contrib.localflavor.it ITPhoneNumberField form phone number validation removed
  • Resolution set to invalid
  • Status changed from new to closed

django.contrib.localflavor is now deprecated — see https://docs.djangoproject.com/en/dev/ref/contrib/localflavor/

A repository was created for each localflavor at https://github.com/django/django-localflavor-? (Replace with the country code.)

If you're still interested in this ticket, could you create a pull request on that repository?

Sorry for not resolving this issue earlier, and thanks for your input!

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.