title: Django/python How to get a list of id's from a list of Objects
body: <p>If I have a list of objects acquired by some query (in this case Django models).</p>
  
  <pre><code>friends = Friend.objects.friends(user1)
  </code></pre>
  
  <p>How can I get the list of ids, so I can use it to search another model, like this:</p>
  
  <pre><code>items = Item.objects.get(pk__in=friends_ids).order_by('date')
  </code></pre>
  
  <p>I'm pretty sure the lambda expressions should be able to do it but I can't figure it out...</p>