Living on the Edge

Model-Inheritance in the Queryset-Refactor Branch

Posted on February 17, 2008

So it appears that while we have all been whimpering about missing inheritance functionality in Django models, Malcolm Tredinnick has been extremely busy getting it implemented. Changeset 7126 adds two very cool pieces to Django’s model options: abstract base classes and model inheritance. According to the docs, model inheritance exists in two varieties:

  • abstract base classes which are a way of specifying common information inherited by the subclasses. They don’t exist as a separate model.
  • non-abstract base classes (the default), which are models in their own right with their own database tables and everything. Their subclasses have references back to them, created automatically.

I will not describe them in full because that’s been done so well in the documentation changes as part of the changeset.

Comments
  1. FooFebruary 18, 2008 @ 01:30 AM

    awesome !

  2. João MarcusFebruary 18, 2008 @ 08:08 AM

    What? Someone was actually working while I was complaining about lack of funcionality? How come? :) Fantastic work!

  3. Handsome GregFebruary 18, 2008 @ 11:12 AM

    This is the best news I’ve heard all month.