Hello folks,

I'm a long time Python developer that is new to Django.  I have a few
questions about the role of inheritance in the models for an app.

As I build my models, I'm finding at least somewhat of a need to start
doing some inheritance, and if not a need--at least a design-related
desire to do it Everything seems to work nicely and neatly in theory
if I stick with concrete super classes, but if I venture in the area
of abstract super classes, things seem to get messy.

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.

In any case, I don't want to give up a abstract super classes until
I've satisfied myself that there is no way to accomplish this.

Any help that can be offered is much appreciated!

Thanks,
~Mark

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to