null value in column "user_id" violates not-null constraint DETAIL: Failing row contains (1, 10000, 11200, null).
this is my models.py
id =models.CharField(max_length=6, primary_key = True, editable=False, unique=True) user = models.ForeignKey(User, on_delete=models.CASCADE)
I was trying to return a Json Response
insert null = True in your id model, this will correct the integrity error.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.