Skip to content

Commit

Permalink
Improve comments
Browse files Browse the repository at this point in the history
  • Loading branch information
raphodn committed May 21, 2024
1 parent 598611a commit c936e54
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
10 changes: 6 additions & 4 deletions lemarche/utils/data.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import io

import phonenumbers

# from phonenumber_field.phonenumber import PhoneNumber
from django.core.management import call_command
from django.db import connection

Expand Down Expand Up @@ -53,8 +51,12 @@ def date_to_string(date, format="%d/%m/%Y"):
def phone_number_is_valid(phone_number):
"""
Ways to check if a phone number is valid:
- phonenumbers.is_valid_number(number_string) / returns True or False
- PhoneNumber.from_string(number_string).is_valid() / returns True or NumberParseException.INVALID_COUNTRY_CODE # noqa
- with phonenumbers
import phonenumbers
phonenumbers.is_valid_number(number_string) / returns True or False
- with PhoneNumber
from phonenumber_field.phonenumber import PhoneNumber
PhoneNumber.from_string(number_string).is_valid() / returns True or NumberParseException.INVALID_COUNTRY_CODE # noqa
A number without a country code (example: +33) will be considered invalid.
"""
Expand Down
3 changes: 2 additions & 1 deletion lemarche/utils/management/commands/cleanup_phone_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ class Command(BaseCommand):
Usage:
python manage.py cleanup_phone_field --model users.User --field phone --dry-run
python manage.py cleanup_phone_field --model tenders.Tender --field contact_phone --dry-run
python manage.py cleanup_phone_field --model siaes.Siae --field contact_phone --dry-run
python manage.py cleanup_phone_field --model siaes.SiaeGroup --field contact_phone --dry-run
"""

def add_arguments(self, parser):
Expand Down

0 comments on commit c936e54

Please sign in to comment.