title: Getting distinct rows based on a certain field from a database in Django
body: <p>I need to construct a query in Django, and I'm wondering if this is somehow possible (it may be really obvious but I'm missing it...).</p>
  
  <p>I have a normal query <code>Model.objects.filter(x=True)[:5]</code> which can return results like this:</p>
  
  <pre>
  <strong>FirstName</strong>    <strong>LastName</strong>    <strong>Country</strong>
  Bob           Jones        UK
  Bill          Thompson     UK
  David         Smith        USA
  </pre>
  
  <p>I need to only grab rows which are distinct based on the <code>Country</code> field, something like <code>Model.objects.filter(x=True).distinct('Country')[:5]</code> would be ideal but that's not possible with Django.</p>
  
  <p>The rows I want the query to grab ultimately are:</p>
  
  <pre>
  <strong>FirstName</strong>    <strong>LastName</strong>    <strong>Country</strong>
  Bob           Jones        UK
  David         Smith        USA
  </pre>
  
  <p>I also need the query to use the same ordering as set in the model's Meta class (ie. I can't override the ordering in any way).</p>
  
  <p>How would I go about doing this?</p>
  
  <p>Thanks a lot.</p>