title: Django models query
body: <p>I have a django model something like</p>
  
  <p>messageto:<br>
  messagefrom:<br>
  message:  </p>
  
  <p>The thing is when I have to display messages between two particular users , I have to go through all messages stored in the database and check both messageto and messagefrom fields.</p>
  
  <p>The way I have worked with django is like each model represents a table, and corresponding to each object of the model class we have a row in the database.</p>
  
  <p>So according to this logic having a separate table for each messageto and messagefrom combo is not possible I think as we need to declare a separate class for each of them.</p>
  
  <p>Is there a way I can find the messages between the users without going through every message?</p>
  
  <p>I am looking for either some way with same implementation or a new implementation any is fine.</p>
  
  <p>Please help.</p>