I have a model that is tracking all of the college football games,
there's an entry for each game, with the two teams represented in the
fields 'team1' and 'team2'. These are foreign keys to the model
'CollegeTeams'. I'm trying to run a query so that it'll get the
results from the Game for each team and display it on the team page.

So I have Game.objects.all() to get all of the games, then what I know
to do would be CollegeTeam.objects.filter(team=game.team1), but what I
want is to get the team if they're team1 or team2. I looked through
the docs and say how do to a lot of variations on the queries, but
didn't see a way to use the objects.filter() with the OR statement.
Any help? Quick example of the query I'm trying to run below.

SELECT from CollegeTeam WHERE team1 = CollegeTeam.id OR team2 =
CollegeTeam.id
--~--~---------~--~----~------------~-------~--~----~
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