Skip to content

Commit

Permalink
User.phone field migration & settings
Browse files Browse the repository at this point in the history
  • Loading branch information
raphodn committed May 15, 2024
1 parent 354ba24 commit 2b6d03b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
2 changes: 2 additions & 0 deletions config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,8 @@

SITE_ID = 1

PHONENUMBER_DEFAULT_REGION = "FR"


# Emails
# ------------------------------------------------------------------------------
Expand Down
20 changes: 20 additions & 0 deletions lemarche/users/migrations/0034_alter_user_phone.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Generated by Django 4.2.13 on 2024-05-15 13:55

import phonenumber_field.modelfields
from django.db import migrations


class Migration(migrations.Migration):
dependencies = [
("users", "0033_user_brevo_contact_id"),
]

operations = [
migrations.AlterField(
model_name="user",
name="phone",
field=phonenumber_field.modelfields.PhoneNumberField(
blank=True, max_length=20, region=None, verbose_name="Téléphone"
),
),
]
3 changes: 2 additions & 1 deletion lemarche/users/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from django.dispatch import receiver
from django.forms.models import model_to_dict
from django.utils import timezone
from phonenumber_field.modelfields import PhoneNumberField

from lemarche.stats.models import StatsUser
from lemarche.users import constants as user_constants
Expand Down Expand Up @@ -165,7 +166,7 @@ class User(AbstractUser):
kind = models.CharField(
verbose_name="Type", max_length=20, choices=user_constants.KIND_CHOICES_WITH_ADMIN, blank=True
)
phone = models.CharField(verbose_name="Téléphone", max_length=20, blank=True)
phone = PhoneNumberField(verbose_name="Téléphone", max_length=20, blank=True)

company = models.ForeignKey(
"companies.Company",
Expand Down

0 comments on commit 2b6d03b

Please sign in to comment.