From 4856276125a140dd7abe22fcd400036c5790a960 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Odini?= Date: Tue, 21 May 2024 14:42:11 +0200 Subject: [PATCH] =?UTF-8?q?feat(Structures):=20g=C3=A9rer=20le=20num=C3=A9?= =?UTF-8?q?ro=20de=20t=C3=A9l=C3=A9phone=20de=20contact=20avec=20une=20lib?= =?UTF-8?q?rairie=20d=C3=A9di=C3=A9e=20(#1221)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../0074_alter_siae_contact_phone_and_more.py | 27 +++++++++++++++++++ lemarche/siaes/models.py | 5 ++-- 2 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 lemarche/siaes/migrations/0074_alter_siae_contact_phone_and_more.py 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 )