title: django comment framework: distinct() does not work?
body: <p>Running distinct() on any field of the comment model always returns all the records,</p>
  
  <blockquote>
    <p>Comment.objects.values('user').distinct()</p>
    
    <p>[{'user': 1}, {'user': 0}, {'user': 0}, {'user': 0}, {'user': 0},
    {'user': 1}, {'user': 1}, {'user': 1}, {'user': 1}]</p>
    
    <p>Comment.objects.values('ip_address').distinct()</p>
    
    <p>[{'ip_address': u'127.0.0.1'},{'ip_address': u'192.168.0.180'},
    {'ip_address':u'192.168.0.180'}, {'ip_address': u'192.168.0.180'},
    {'ip_address': u'192.168.0. 180'}, {'ip_address': u'192.168.0.180'},
    {'ip_address': u'192.168.0.180'}, {'ip_address': u'192.168.0.180'},
    {'ip_address': u'192.168.0.180'}]</p>
  </blockquote>
  
  <p>Why is this happening? Is there a way around this? Thanks!</p>
  
  <p>ps: distinct() does run very well in different types of fields of a custom model during my test. Something special about the Comments framework?</p>
  
  <p><strong>Bit of conclusion</strong>
  Thanks everybody answering this question, combined with some reading I get conclusion as following:</p>
  
  <ol>
  <li>values() influences the lookup fields in SELECT part of the final
  sql("<a href="https://docs.djangoproject.com/en/1.3/ref/models/querysets/#values" rel="noreferrer">values() takes optional positional arguments, *fields, which
  specify field names to which the SELECT should be limited</a>")</li>
  <li>order_by() adds its parameter to the SELECT part as well.</li>
  <li><p>using distinct() in a look up will result the sql to look like this: </p>
  
  <blockquote>
    <p>SELECT <strong>DISTINCT</strong> [fields1, fields2, fields3] FROM ... WHERE...</p>
  </blockquote>
  
  <p>and the values of the fields all together decides whether a record is unique. The fields may come from values() or order_by() functions in the lookup.</p></li>
  <li><p><a href="https://docs.djangoproject.com/en/1.3/ref/models/querysets/#distinct" rel="noreferrer">So the order_by() is adding some unwanted effects when combined with distinct(), the fields specified in order_by is also take into consideration whether a record is unique</a></p></li>
  <li><p>Django Comment has a hidden order_by parameter by default, thus creating the whole problem. Any model has a hidden order_by when returning the qs can cause the same problem.</p></li>
  <li>The way of solving it is by adding an empty order_by() at the end of
  the lookup, which removes the default order_by.</li>
  </ol>