title: Rendering group by queries on django admin interface. (distinct values on a field is broken in django)
body: <p>There is a table datagen_crawlmeta with id as the primary key.
  I want to get the distinct nm from the table and display it.</p>
  
  <pre><code>mysql&gt; SELECT id, gid_id, nm from datagen_crawlmeta limit 10;
  +----+--------+----------------------------+
  | id | gid_id | nm                         |
  +----+--------+----------------------------+
  |  1 |      1 | votes                      |
  |  2 |      1 | performance_rating         |
  |  3 |      1 | title                      |
  |  4 |      1 | specs__Sound__Loudspeaker  |
  |  5 |      1 | specs__Sound__3.5mm jack   |
  |  6 |      1 | specs__Sound__Alert types  |
  |  7 |      1 | specs__Sound__unknown0     |
  |  8 |      1 | specs__Features__Java      |
  |  9 |      1 | specs__Features__Messaging |
  | 10 |      1 | specs__Features__Colors    |
  +----+--------+----------------------------+
  10 rows in set (0.00 sec)
  </code></pre>
  
  <p>Using the following code is returning all the rows.
  Its because <code>self.model.objects.all().distinct('nm')</code> is returning CrawlMeta object and not the distinct nm.</p>
  
  <p>I could use <code>self.model.objects.values_list('nm', flat=True).distinct()</code> but it returns
  list of nm which is incompatible with the return type of queryset.</p>
  
  <pre><code>class CrawlMetaAdmin(admin.ModelAdmin):
      list_display = ['nm']
  
      def queryset(self, request):
          query_dict = request.GET
          nm = query_dict.get('nm')
          return self.model.objects.all().distinct('nm')
  </code></pre>
  
  <p>My final aim is to show the nm and count in the django admin interface using the
  following query.</p>
  
  <pre><code>select nm, count(*) from datagen_crawlmeta group by nm;
  </code></pre>