im trying to get mptt working with my current project, but having issues with the database migration.
here is my model
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']
and im running this in the command line:
sudo python manage.py makemigrations core
but seem to be getting and error related to the level field
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:
what should I do?