Error dynamically adding a field to a model in Django 1.7

62 views
Skip to first unread message

Craig de Stigter

unread,
Sep 21, 2014, 5:59:17 PM9/21/14
to django...@googlegroups.com
Hi folks

My app django-mptt has a function which dynamically adds a field to a model. A common use-case is hierarchical groups:

from mptt.models import TreeForeignKey, register
from django.contrib.auth.models import Group
TreeForeignKey(Group, blank=True, null=True).contribute_to_class(Group, 'parent')
register(Group)


This works great until Django 1.7. I've recently added 1.7 to the tox config and now I'm getting errors during the migration process:

django.db.utils.OperationalError: no such column: auth_group.parent_id

(full traceback here)

Seems the migration system isn't handling the monkey-patched field properly.

Does anyone know how to avoid this?

Cheers
Craig de Stigter
Reply all
Reply to author
Forward
0 new messages