diff --git a/lemarche/siaes/migrations/0074_alter_siae_contact_phone_and_more.py b/lemarche/siaes/migrations/0074_alter_siae_contact_phone_and_more.py new file mode 100644 index 000000000..ccca2bc54 --- /dev/null +++ b/lemarche/siaes/migrations/0074_alter_siae_contact_phone_and_more.py @@ -0,0 +1,27 @@ +# Generated by Django 4.2.13 on 2024-05-17 15:20 + +import phonenumber_field.modelfields +from django.db import migrations + + +class Migration(migrations.Migration): + dependencies = [ + ("siaes", "0073_siae_brevo_company_id"), + ] + + operations = [ + migrations.AlterField( + model_name="siae", + name="contact_phone", + field=phonenumber_field.modelfields.PhoneNumberField( + blank=True, max_length=150, region=None, verbose_name="Téléphone" + ), + ), + migrations.AlterField( + model_name="siaegroup", + name="contact_phone", + field=phonenumber_field.modelfields.PhoneNumberField( + blank=True, max_length=150, region=None, verbose_name="Téléphone" + ), + ), + ] diff --git a/lemarche/siaes/models.py b/lemarche/siaes/models.py index aba0ae26c..12c273088 100644 --- a/lemarche/siaes/models.py +++ b/lemarche/siaes/models.py @@ -16,6 +16,7 @@ from django.utils.encoding import force_str from django.utils.functional import cached_property from django.utils.text import slugify +from phonenumber_field.modelfields import PhoneNumberField from lemarche.perimeters.models import Perimeter from lemarche.siaes import constants as siae_constants @@ -88,7 +89,7 @@ class SiaeGroup(models.Model): verbose_name="Site internet", help_text="Doit commencer par http:// ou https://", blank=True ) contact_email = models.EmailField(verbose_name="E-mail", blank=True, db_index=True) - contact_phone = models.CharField(verbose_name="Téléphone", max_length=150, blank=True) + contact_phone = PhoneNumberField(verbose_name="Téléphone", max_length=150, blank=True) contact_social_website = models.URLField( verbose_name="Réseau social", help_text="Doit commencer par http:// ou https://", blank=True ) @@ -688,7 +689,7 @@ class Siae(models.Model): blank=True, help_text="Le contact renseigné ici recevra les opportunités commerciales par mail", ) - contact_phone = models.CharField(verbose_name="Téléphone", max_length=150, blank=True) + contact_phone = PhoneNumberField(verbose_name="Téléphone", max_length=150, blank=True) contact_social_website = models.URLField( verbose_name="Réseau social", help_text="Doit commencer par http:// ou https://", blank=True )