내 models.py에서 모델 상속을 사용하고 있습니다. 이건 내 코드입니다 :상속을 사용하여 모델 : 기본값없이 typemod에 nullable 필드 'id'를 추가하려고합니다.
class Email(models.Model):
stuff = models.CharField(max_length=40, blank=True,
null=True, default="")
class TypeMod(Email):
pass
내가 makemigrations를 실행하면 내가 이메일 모델에서 내 모든 필드에 대한 기본 값을 설정하고 있지만, 다음과 같은 메시지가 뜹니다 :
You are trying to add a non-nullable field 'id' to typemod 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 with a null value for this column) 2) Quit, and let me add a default in models.py
내가 뭘 잘못된?!
매우 신중하게 읽으십시오. 오류 없음 – e4c5