On Sun, 2008-11-30 at 03:14 -0200, Felipe Sodré Silva wrote:
> Hello folks. I have three models:

[...]
> I know that this is going to generate three different tables.
> I want to know if is it possible to do:
> 
> cars = Car.objects.all()
> for c in cars: 
> ..print c.render()
> 
> and get the expected result, without having to check the actual type
> of each car.

That depends on your definition of "expected result". Since you're
iterating over a queryset of Car objects, you'll get back a Car object
each time. That's a fairly natural expectation.

However, if you are guessing that you'll get back the most-derived
object (Porsche, etc), then no that won't happen, since it requires
information that isn't possible to encode into a single SQL query with
what Django has available at the moment it makes the query.

Regards,
Malcolm



--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to