Skip to content

Commit

Permalink
feat: update phone number validator message
Browse files Browse the repository at this point in the history
  • Loading branch information
andrey-canon committed Jul 16, 2024
1 parent 69228b5 commit 63b856b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 3.2.21 on 2024-07-16 21:18

import django.core.validators
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('student', '0044_courseenrollmentcelebration_celebrate_weekly_goal'),
]

operations = [
migrations.AlterField(
model_name='userprofile',
name='phone_number',
field=models.CharField(blank=True, max_length=50, null=True, validators=[django.core.validators.RegexValidator(message="Phone number must start with '+' (optional) followed by digits (0-9) only.", regex='^\\+?1?\\d*$')]),
),
]
5 changes: 4 additions & 1 deletion common/djangoapps/student/models/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,10 @@ class Meta:
goals = models.TextField(blank=True, null=True)
bio = models.CharField(blank=True, null=True, max_length=3000, db_index=False)
profile_image_uploaded_at = models.DateTimeField(null=True, blank=True)
phone_regex = RegexValidator(regex=r'^\+?1?\d*$', message="Phone number can only contain numbers.")
phone_regex = RegexValidator(
regex=r'^\+?1?\d*$',
message="Phone number must start with '+' (optional) followed by digits (0-9) only.",
)
phone_number = models.CharField(validators=[phone_regex], blank=True, null=True, max_length=50)

@property
Expand Down

0 comments on commit 63b856b

Please sign in to comment.