Skip to content

Commit

Permalink
Fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
JobDoesburg committed Apr 10, 2024
1 parent f07f5fb commit a459d9b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
17 changes: 17 additions & 0 deletions website/users/migrations/0002_alter_user_email.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 4.2.9 on 2024-04-10 07:37

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("users", "0001_initial"),
]

operations = [
migrations.AlterField(
model_name="user",
name="email",
field=models.EmailField(max_length=254),
),
]
4 changes: 3 additions & 1 deletion website/users/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class User(AbstractUser):
REQUIRED_FIELDS = ["email"]

username = models.CharField(max_length=30, unique=True)
email = models.EmailField(unique=True)
email = models.EmailField(unique=False)
full_name = models.CharField(max_length=100)

override_display_name = models.CharField(max_length=100, blank=True, null=True)
Expand All @@ -85,6 +85,8 @@ def extract_first_and_last_name_from_username(self):
def save(self, *args, **kwargs):
"""Override save method."""
self.extract_first_and_last_name_from_username()
self.username = self.username.lower()
self.email = self.email.lower()
return super(User, self).save(*args, **kwargs)

def __str__(self):
Expand Down

0 comments on commit a459d9b

Please sign in to comment.