Skip to content

Commit

Permalink
Update username ID to a UUID
Browse files Browse the repository at this point in the history
  • Loading branch information
tudoramariei committed Feb 5, 2024
1 parent b70f39d commit 7e67505
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion backend/users/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
@admin.register(User)
class UserAdmin(admin.ModelAdmin):
list_display = (
"id",
"pk",
"email",
)
list_display_links = ("email",)
19 changes: 19 additions & 0 deletions backend/users/migrations/0002_alter_user_id.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 4.2.9 on 2024-02-05 09:24

from django.db import migrations, models
import uuid


class Migration(migrations.Migration):

dependencies = [
("users", "0001_initial"),
]

operations = [
migrations.AlterField(
model_name="user",
name="id",
field=models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True),
),
]
2 changes: 2 additions & 0 deletions backend/users/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ class User(AbstractUser):
instead of the username
"""

id = models.UUIDField(primary_key=True, unique=True, default=uuid.uuid4, editable=False)

# We ignore the "username" field because the authentication
# will be done by email + password
username = models.CharField(
Expand Down

0 comments on commit 7e67505

Please sign in to comment.