現在のプロジェクトで mptt を動作させようとしていますが、データベースの移行に問題があります。
ここに私のモデルがあります
from django.db import models
from mptt.models import MPTTModel, TreeForeignKey
class Section(MPTTModel):
name = models.CharField(max_length=50, unique=True)
parent = TreeForeignKey('self', null=True, blank=True, related_name='children', db_index=True)
class MPTTMeta:
order_insertion_by = ['name']
コマンドラインでこれを実行しています:
sudo python manage.py makemigrations core
しかし、レベルフィールドに関連するエラーが発生しているようです
You are trying to add a non-nullable field 'level' to section 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
Select an option:
私は何をすべきか?