Is multi-table inheritance bad?

Daniel and Audrey were so nice to offer me a free copy of their book Two scoops of Django. I gratefully accept it as a gift and an encouragement for my work on Lino.

Wow! this book is so great! I just can’t wait to try all the new ideas I got already during the five first chapters! Examples: use relative imports, use pip and virtualenv, move all settings to the code repository, …

… but I stopped at the beginning of chapter 6 because it’s too dangerous to continue right now: I must keep Lino and my mind stable during the next 2 weeks because I’m going to travel to Belgium and show Lino to potential partners and customers.

The question continued to haunt me, however, I had a sleepless night because the authors write:

Multi-table inheritance, sometimes called ‘concrete inheritance’, is considered by the authors and many other developers to be a bad thing. We strongly recommend against using it.

That statement was a challenge to me. I had to either understand that they are right or show that they are wrong.

I had to reopen ticket docs/tickets/22! Sigh! Everything there seemed so clear to me!

And after some meditation I understood that indeed it’s not clear! An important observation was the fact that a Partner is either a Person or an Organization, not both. Another hint is the fact that lino.utils.mti will break in Django 1.6. Conclusion: I was wrong. We can do it without MTI, it just depends on how the user interface handles it!

As a proof of concept I wrote the new module lino.modlib.partners which is going to replace lino.modlib.contacts.

This also caused some small optimizations:

  • when_prepared now supports more than one argument, each of them being a model_spec.
  • Better error messages at some internal places

But this proof of concept is not finised. The main challenge is docs/tickets/73.

Also opened new ticket docs/tickets/72.

Pre-release rush

  • The Lino Cosi online demo had a “‘State’ object has no attribute ‘editable’” traceback caused by lino.modlib.vat.models.DelarationStates. Fixed.
  • Increased the version counters.