title: Django - Sort a list by related fields
body: <p>My models:</p>
  
  <pre><code>Item:
      name
      desc
  
  Type:
      name
  
  Value:
      item.ForeignKey(Item)
      type.ForeignKey(Type)
      val.CharField # varchar or numeric
  </code></pre>
  
  <p>Now I have an objects list of items but not a QuerySet, for instance: <code>items = [&lt;object:1&gt;, &lt;object:2&gt;, &lt;object:4&gt;]</code>. And <code>t = 5</code> is an id of a row from Type.</p>
  
  <p>I want to sort this list by <code>val</code> of table <code>Value</code> and type of value is <code>t</code>. Any idea?</p>
  
  <p>Thanks alot!</p>
  
  <p><strong>UPDATE:</strong><br>
  - I've added a new condition.</p>