in most use cases:
xxxxxxxxxx
class MyUUIDModel(models.Model):
id = models.UUIDField(
primary_key = True,
default = uuid.uuid4,
editable = False)
xxxxxxxxxx
from django.db import models
import uuid
class MyModel(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
# Other model fields...
xxxxxxxxxx
id = models.UUIDField(primary_key=True, default=str(uuid.uuid4()), editable=False)
if not work uuid so convert into str() method
image.mefiz.com
xxxxxxxxxx
import uuid
from django.db import models
class MyUUIDModel(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
# other fields