You are trying to add a non-nullable field 'list' to signup without a default; we can't do that (the database needs something to populate existing rows). Please select a fix: 1) Provide a one-off default now (will be set on all existing rows) 2) Quit, and let me add a default in models.py
This is the error for the following code for ArrayField
:
from django.contrib.postgres.fields import ArrayField
from django.db import models
class signup(models.Model):
userid=models.CharField(max_length=10)
password=models.CharField(max_length=10)
list=ArrayField(models.IntegerField(null=True,blank=True),size=5)
score=models.IntegerField(default=0)
You must specify that list
can be null
in the database:
list=ArrayField(models.IntegerField(null=True, blank=True), size=5, null=True)