> If I have my abstract super classes inherit models.Model,  things
> technically can work. However, I arrive with a rather overly complex
> SQL design generated from them (like needless tables for abstract
> super classes).
> 
> On the other hand, if I have my abstract super classes NOT inherit
> models.Model and then use multiple inheritance on my subclasses (ie.
> have the subclasses inherit both models.Model and their Super class),
> then I end up with non-functional SQL tables (ie. the SQL table for a
> model would not contain critical fields that in the model had been
> inherited from their super class).
> 
> Am I missing something? Is there a way to have my models include
> properties inherited from an abstract super class into the SQL it
> generates? And ideally without creating tables for each abstract super
> class? Or is this just too much in the way of complex OO for
> models.py, and maybe I'm just over-doing it and  an experienced Django
> developer will point out the futility of what I'm trying.

When you define an abstract model, you have to define the ``abstract''
property inside its Meta.
http://docs.djangoproject.com/en/1.2/ref/models/options/#abstract
http://docs.djangoproject.com/en/1.2/topics/db/models/#abstract-base-classes

That way your abstract class can inherit models.Model and will have no
database table created.

Michal Petrucha

Attachment: signature.asc
Description: Digital signature

Reply via email to