I tried to apply mptt in my django program on a existing model using the method provided on the main site of mptt, which is as follow:
import mptt
from mptt.fields import TreeForeignKey
from django.contrib.auth.models import Group
# add a parent foreign key
TreeForeignKey(Group, blank=True, null=True, db_index=True).contribute_to_class(Group,'self')
mptt.register(Group, order_insertion_by=['name'])
However, when I open my group list in the admin-site, it says that the group model doesn't have such column named parent_id, I wonder how I can fix it.
BTW the code have been written in models.py,is it possible that I should have written it in admin.py?
reference: Registration of existing models
Edit:
sorry about the comment...migrations does solve the problem ><
However it leads to another question...can I only create a group by code to create a new tree structure, or it's possible for me to do that somewhere in my admin site?
Thanks for the answering and attention:)