>>> Leaderboard.objects.distinct('DEVICEID') Traceback (most recent call last): File "", line 1, in File "/Applications/djangostack-1.3.1-0/python/lib/python2.6/site-packages/django/db/models/query.py", line 72, in __repr__ data = list(self[:REPR_OUTPUT_SIZE + 1]) File "/Applications/djangostack-1.3.1-0/python/lib/python2.6/site-packages/django/db/models/query.py", line 87, in __len__ self._result_cache.extend(self._iter) File "/Applications/djangostack-1.3.1-0/python/lib/python2.6/site-packages/django/db/models/query.py", line 291, in iterator for row in compiler.results_iter(): File "/Applications/djangostack-1.3.1-0/python/lib/python2.6/site-packages/django/db/models/sql/compiler.py", line 763, in results_iter for rows in self.execute_sql(MULTI): File "/Applications/djangostack-1.3.1-0/python/lib/python2.6/site-packages/django/db/models/sql/compiler.py", line 808, in execute_sql sql, params = self.as_sql() File "/Applications/djangostack-1.3.1-0/python/lib/python2.6/site-packages/django/db/models/sql/compiler.py", line 91, in as_sql result.append(self.connection.ops.distinct_sql(distinct_fields)) File "/Applications/djangostack-1.3.1-0/python/lib/python2.6/site-packages/django/db/backends/__init__.py", line 572, in distinct_sql raise NotImplementedError('DISTINCT ON fields is not supported by this database backend') NotImplementedError: DISTINCT ON fields is not supported by this database backend >>> Leaderboard.objects.distinct() [, , , , , , , , , , , , , , , , , , , , '...(remaining elements truncated)...'] KeyboardInterrupt >>> ################### ################### AFTER I MADE THE CHANGE PROPOSED IN MY ATTACHED PATCH ################### ################### bash-3.2$ python manage.py shell Python 2.6.5 (r265:79063, Sep 20 2011, 08:38:57) [GCC 4.0.1 (Apple Computer, Inc. build 5250)] on darwin Type "help", "copyright", "credits" or "license" for more information. (InteractiveConsole) >>> from V1API.models import * >>> Leaderboard.objects.distinct('DEVICEID').values('DEVICEID').count() 175 >>> KeyboardInterrupt >>> bash-3.2$ python manage.py version 1.4