I believe in your template you should be able to do something like:

{% for p in project_portfolio_list %}
  {{ p.project_name_char }} {{ p.project_client.client_name_char }}
{% endfor %}

If you had a view with:

context['project_portfolio_list'] = project_portfolio.objects.all()


You'll also want to be familiar with this portion of the docs:
http://www.djangoproject.com/documentation/db-api/#related-objects


Hope that helps,
Grant

On Jul 19, 11:02 am, Joshua <[EMAIL PROTECTED]> wrote:
> I've tried to search for a solution to this problem for the last 2
> hours and I can't seem to figure it out.
>
> I basically want to return a joined table from a queryset - formatted
> for my template.
>
> I can't seem to figure out how to do this with the Django database
> API.
>
> With SQL a join query works out to:
>
> '''
> select project_portfolio.*, client.*
> from project_portfolio left join client
> on project_portfolio.id = client.id
> '''
> with the following simplified models:
>
> class project_portfolio(models.Model):
>     project_name_char = models.CharField()
>     project_client = models.ForeignKey(client)
>
> class client(models.Model):
>     client_name_char = models.CharField
>
> The challenge here seems to be that I have to return MULTIPLE
> project_portfolio objects and THEN get the "client" data - because NOT
> all "clients" have "project_portfolio(s)"
>
> Thank you in advance for any help - Josh


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