39👍
✅
Use AbstractUser model if you need changes in the default user model.
import uuid
from django.db import models
from django.contrib.auth.models import AbstractUser
class MyUser(AbstractUser):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
Then in your settings.py
,
AUTH_USER_MODEL = 'myapp.MyUser'
0👍
If you had already executed any migrations before making the UUID change, it is crucial to delete the tables and recreate the migrations.
- [Django]-Django – Cannot create migrations for ImageField with dynamic upload_to value
- [Django]-Simple way to reset Django PostgreSQL database?
- [Django]-Aggregation of an annotation in GROUP BY in Django
Source:stackexchange.com