From 75c209a1d87c3ea0dfcaf55b2428124386ae9bc3 Mon Sep 17 00:00:00 2001 From: Laurent Date: Wed, 5 Jun 2024 15:16:16 +0200 Subject: [PATCH] Makes the email field unique --- .../migrations/0067_alter_customuser_email.py | 18 ++++++++++++++++++ tournaments/models/custom_user.py | 1 + 2 files changed, 19 insertions(+) create mode 100644 tournaments/migrations/0067_alter_customuser_email.py diff --git a/tournaments/migrations/0067_alter_customuser_email.py b/tournaments/migrations/0067_alter_customuser_email.py new file mode 100644 index 0000000..5bd0a22 --- /dev/null +++ b/tournaments/migrations/0067_alter_customuser_email.py @@ -0,0 +1,18 @@ +# Generated by Django 4.2.11 on 2024-06-05 13:13 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('tournaments', '0066_alter_club_broadcast_code'), + ] + + operations = [ + migrations.AlterField( + model_name='customuser', + name='email', + field=models.EmailField(max_length=254, unique=True), + ), + ] diff --git a/tournaments/models/custom_user.py b/tournaments/models/custom_user.py index de46ad3..b0be0a0 100644 --- a/tournaments/models/custom_user.py +++ b/tournaments/models/custom_user.py @@ -6,6 +6,7 @@ import uuid class CustomUser(AbstractUser): pass id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=True) + email = models.EmailField(unique=True) umpire_code = models.CharField(max_length=50, blank=True, null=True) clubs = models.ManyToManyField(club.Club, blank=True) phone = models.CharField(max_length=15, null=True, blank=True)