>
> I just want to make a join through this tables with the select_related
> to be able to print Image.name, Instrument.name, Channel.name

Your query would be something like this:

images = Image.objects.select_related()

You can use this query set in your templates or in Python:

Template example:

<ul>
{% for image in images %}
    <li>{{ image.name }}</li>
    <li>{{ image.instrument.name }}</li>
    <li>{{ image.channel.name }}</li>
{% endfor %}
</ul>

Python:

for image in images:
    print image.name, image.instrument.name, image.channel.name


> And i don't know how to do this

Hope the above helps. Also, you should understand how select_related
works. Ot's main purpose is to save you DB trips but it can cause
performance problems if not used properly. Read on here for further
details:

http://www.djangoproject.com/documentation/db-api/#select-related
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
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