Skip to content

Commit 7e67505

Browse files
committed
Update username ID to a UUID
1 parent b70f39d commit 7e67505

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

backend/users/admin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
@admin.register(User)
77
class UserAdmin(admin.ModelAdmin):
88
list_display = (
9-
"id",
9+
"pk",
1010
"email",
1111
)
1212
list_display_links = ("email",)
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Generated by Django 4.2.9 on 2024-02-05 09:24
2+
3+
from django.db import migrations, models
4+
import uuid
5+
6+
7+
class Migration(migrations.Migration):
8+
9+
dependencies = [
10+
("users", "0001_initial"),
11+
]
12+
13+
operations = [
14+
migrations.AlterField(
15+
model_name="user",
16+
name="id",
17+
field=models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True),
18+
),
19+
]

backend/users/models.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ class User(AbstractUser):
4545
instead of the username
4646
"""
4747

48+
id = models.UUIDField(primary_key=True, unique=True, default=uuid.uuid4, editable=False)
49+
4850
# We ignore the "username" field because the authentication
4951
# will be done by email + password
5052
username = models.CharField(

0 commit comments

Comments
 (0)