title: Traversing Django Foreign Keys efficiently for query sets
body: <p>I'm having trouble efficiently getting (second degree) related objects.
  My models currently look like this </p>
  
  <pre><code>class Transaction(models.Model):
    from_account = models.ForeignKey(Account, related_name="sent")
    to_account = models.ForeignKey(Account, related_name="recieved")
    ...
  
  class Account(models.Model):
    address = models.CharField(max_length=42, primary_key=True)
    ...
  </code></pre>
  
  <p>What I have been doing so far to get an aggregated list of <code>transaced_with</code> for an account is as follows:</p>
  
  <pre><code>accs = []
  if hasattr(account, 'recieved'):
      for tx in account.recieved.all():
          acc = tx.from_account
          accs.append(acc)
  
  if hasattr(account, 'sent'):
      for tx in account.sent.all():
          acc = tx.to_account
          accs.append(acc)
  return  accs
  </code></pre>
  
  <p>This way however is very slow, so I was wondering, 
  what is the the efficient way to aggregate these sort of related objects? What I want in the end is a list of <code>address</code> from the <code>Account</code>s in <code>accs</code></p>