Answers for "create primary key django model"

3

primary key django model

class Garden(models.Model):
    garden_id = models.IntegerField(primary_key=True)
Posted by: Guest on April-29-2020
-1

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
Posted by: Guest on May-04-2021

Code answers related to "create primary key django model"

Python Answers by Framework

Browse Popular Code Answers by Language