1👍
✅
As Vishal Singh commented, the UUIDField
class from Django’s Model
can be used to create
A field for storing universally unique identifiers.
As mentioned here.
Usage could be as following:
import uuid
from django.db import models
class Customer(models.Model):
id_ = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
name = models.CharField(max_length=255)
class OnlineCustomer(models.Model):
id_ = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
name = models.CharField(max_length=255)
Source:stackexchange.com