Custom CMSPlugin migrations in Django 1.7

101 views Asked by At

I'm using Django CMS 3.1 with Django 1.7.8. I'm trying to upgrade an old project to these respective versions but I'm hitting a brick wall with a couple of my custom-written CMSPlugin-inhereting plugins.

Django won't migrate any models.

django.db.migrations.state.InvalidBasesError: Cannot resolve bases for [..My Models..]

The models are defined as they are in the latest documentation:

from cms.models.pluginmodel import CMSPlugin

class Layout(CMSPlugin):
    ...

What do I need to do to let Django know how these CMSPlugin descendants are supposed to migrate? Note these models don't have any migrations. I deleted the south ones.

1

There are 1 answers

0
Louis On BEST ANSWER

Note these models don't have any migrations.

That's your problem right there. The way you are using CMSPlugin as a base for your new model requires that your model be subject to migration because CMSPlugin is also subject to migrations.

The documentation says:

Be aware, however, that unmigrated apps cannot depend on migrated apps, by the very nature of not having migrations.

The documentation says more but the details it adds are not particularly useful to determine whether you are in trouble. However, you can look at this ticket where the reporter was trying to create a custom user model by inheriting from django.contrib.auth.models.User and ran into the issue you ran into. See also this other ticket in which the Django devs decided to write error messages that specifically point out that inheritance is a possible cause of the problem you've run into.