As mentioned in the answer, you need to declare a primary key in a non-automatic field. For instance:
from django.db import models class Person(models.Model): username = CharField(primary_key=True, max_length=100) first_name = CharField(null=True, blank=True, max_length=100)
Note that setting the field to primary_key=True automatically makes it unique, not null. Good luck
source share