django make primary key code example
Example 1: primary key django model
class Garden(models.Model):
garden_id = models.IntegerField(primary_key=True)
Example 2: django custom primary key field
import uuid
from django.db import models
class MyUUIDModel(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
# other fields