Skip to content

Commit 26ebc4f

Browse files
committed
Validation for speaker code must also allow for elicitors
1 parent 0504556 commit 26ebc4f

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Generated by Django 4.2.24 on 2025-09-22 23:27
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
("validation", "0058_alter_historicalphrase_osid_alter_phrase_osid"),
10+
]
11+
12+
operations = [
13+
migrations.AlterField(
14+
model_name="speaker",
15+
name="gender",
16+
field=models.CharField(
17+
blank=True,
18+
choices=[("M", "Male"), ("F", "Female")],
19+
help_text="Gender of the voice.",
20+
max_length=1,
21+
null=True,
22+
),
23+
),
24+
]

validation/models.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -548,11 +548,12 @@ def anonymous(self):
548548

549549
def clean(self):
550550
self.code = self.code.strip().upper()
551-
if not re.match(r"\A[A-Z]+[0-9]?\Z", self.code):
551+
if not re.match(r"\A(E-)?[A-Z]+[0-9]?\Z", self.code):
552552
raise ValidationError(
553553
_(
554554
"Speaker code must be a single all-caps word, "
555-
"optionally followed by a digit"
555+
"optionally followed by a digit, "
556+
"optionally prefaced by E- (for elicitors)"
556557
)
557558
)
558559

0 commit comments

Comments
 (0)