Hi again,

2012/7/7 Tomas Neme <lacrymol...@gmail.com>:
>> The big difference is, -as I see it- I will not get real polymorphism,
>> as the base class would need to do the join on all it's child classes.
>> Is that true?
>
> with abstract models you won't get polymorphism at all, in the
> database level (this is, you WON'T be able to do Fruit.objects....).
> You'll mostly just be sharing structure and behavior, saving yourself
> some repetition.
>
> With multi table inheritane (MTI) you get three tables, one for Fruits
> one for Oranges and one for Apples, Fruits have a row for every Orange
> and every Apple, so you can do Fruit.objects.all(). Knowing whether
> this is an orange or an apple is trickier, but not too much
>

...but using the django abstraction, what would happen, if I implement
this as MTI?
Say I implement the functions:
def Fruit.rott(): pass
def Apple.rott(): get_wrinkles()
def Orange.rott(): color=green

and I do
for fruit in Fruits.objects.all(): fruit.rott()

will anything happen at all? I know in C++ this would work... ;-)

on database-level I know how to do it, I just don't know if the django
abstraction handles this automalically.

Seems I have too little faith in the capabilities of python ;-)

Best regards

Daniel

-- 
Daniel Walz - mcj...@gmail.com
Bremen, Germany

-- 
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