title: Django - filtering on related objects
body: <p>For my Django app I have Events, Ratings, and Users. Ratings are related to Events and Users through a foreign keys.  When displaying a list of Events I want to filter the ratings of the Event by a user_id so I know if an event has been rated by the user. </p>
  
  <p>If I do:</p>
  
  <pre><code>event_list = Event.objects.filter(rating__user=request.user.id)
  </code></pre>
  
  <p>(request.user.id gives the user_id of the current logged in user) ...then I only get the events that are rated by the user and not the entire list of events.</p>
  
  <p>What I need can be generated through the custom SQL:</p>
  
  <pre><code>SELECT *
  FROM `events_event`
  LEFT OUTER JOIN (
    SELECT *
    FROM `events_rating`
    WHERE user_id = ##
    ) AS temp 
  ON events_event.id = temp.user_id
  </code></pre>
  
  <p>Is there an easier way so I don't have to use custom SQL?</p>