Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#23574 closed Bug (invalid)

Makemigrations tries to migrate non-model classes

Reported by: Christian Peters Owned by: nobody
Component: Migrations Version: 1.7
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


If your model extends non-model classes, the migration fails with:

raise ValueError("Cannot serialize: %r\nThere are some values Django cannot serialize into migration files.\nFor more, see

The reason is that before adding the base classes there is no check if the base class is indeed a django model:

Solution: Check if the base class is an instance of django.db.model before adding it.


I have Models with some mixins that just add method and functionality that is shared among multiple models, e.g. an InvoiceMixin, that is shared by multiple models to enrich them with convenience methods.

Change History (3)

comment:1 Changed 6 years ago by Christian Peters

Type: UncategorizedBug

comment:2 Changed 6 years ago by Christian Peters

Resolution: invalid
Status: newclosed

comment:3 Changed 6 years ago by Christian Peters

It turned out, that I just need to inherit the mixin from object to make it work in django 1.7

Note: See TracTickets for help on using tickets.
Back to Top