Which one is better option to choose as a Primary key for Cart in Django? UUID or Session Key?
So, I have been working on a DRF eCommerce project. As, using the auto incrementing id field in the cart model isn't ideal. I chose to use UUIDField for it. I can achieve the same with session key too. But, I was wondering if there is any approach that meets the industry standard? Please suggest me the more appropriate primary key choice with a explanation from a industry point of view.
class Cart(models.Model):
id = models.UUIDField(primary_key=True, default=uuid4)
skey = models.CharField(max_length=250, null=True)
total_price = models.PositiveIntegerField(editable=False, blank=True, null=True)
date_added = models.DateField(auto_now_add=True)
def __str__(self):
return self.skey