| 1 | >>> Leaderboard.objects.distinct('DEVICEID')
|
|---|
| 2 | Traceback (most recent call last):
|
|---|
| 3 | File "<console>", line 1, in <module>
|
|---|
| 4 | File "/Applications/djangostack-1.3.1-0/python/lib/python2.6/site-packages/django/db/models/query.py", line 72, in __repr__
|
|---|
| 5 | data = list(self[:REPR_OUTPUT_SIZE + 1])
|
|---|
| 6 | File "/Applications/djangostack-1.3.1-0/python/lib/python2.6/site-packages/django/db/models/query.py", line 87, in __len__
|
|---|
| 7 | self._result_cache.extend(self._iter)
|
|---|
| 8 | File "/Applications/djangostack-1.3.1-0/python/lib/python2.6/site-packages/django/db/models/query.py", line 291, in iterator
|
|---|
| 9 | for row in compiler.results_iter():
|
|---|
| 10 | File "/Applications/djangostack-1.3.1-0/python/lib/python2.6/site-packages/django/db/models/sql/compiler.py", line 763, in results_iter
|
|---|
| 11 | for rows in self.execute_sql(MULTI):
|
|---|
| 12 | File "/Applications/djangostack-1.3.1-0/python/lib/python2.6/site-packages/django/db/models/sql/compiler.py", line 808, in execute_sql
|
|---|
| 13 | sql, params = self.as_sql()
|
|---|
| 14 | File "/Applications/djangostack-1.3.1-0/python/lib/python2.6/site-packages/django/db/models/sql/compiler.py", line 91, in as_sql
|
|---|
| 15 | result.append(self.connection.ops.distinct_sql(distinct_fields))
|
|---|
| 16 | File "/Applications/djangostack-1.3.1-0/python/lib/python2.6/site-packages/django/db/backends/__init__.py", line 572, in distinct_sql
|
|---|
| 17 | raise NotImplementedError('DISTINCT ON fields is not supported by this database backend')
|
|---|
| 18 | NotImplementedError: DISTINCT ON fields is not supported by this database backend
|
|---|
| 19 |
|
|---|
| 20 | >>> Leaderboard.objects.distinct()
|
|---|
| 21 | [<Leaderboard: Leaderboard object>, <Leaderboard: Leaderboard object>, <Leaderboard: Leaderboard object>, <Leaderboard: Leaderboard object>, <Leaderboard: Leaderboard object>, <Leaderboard: Leaderboard object>, <Leaderboard: Leaderboard object>, <Leaderboard: Leaderboard object>, <Leaderboard: Leaderboard object>, <Leaderboard: Leaderboard object>, <Leaderboard: Leaderboard object>, <Leaderboard: Leaderboard object>, <Leaderboard: Leaderboard object>, <Leaderboard: Leaderboard object>, <Leaderboard: Leaderboard object>, <Leaderboard: Leaderboard object>, <Leaderboard: Leaderboard object>, <Leaderboard: Leaderboard object>, <Leaderboard: Leaderboard object>, <Leaderboard: Leaderboard object>, '...(remaining elements truncated)...']
|
|---|
| 22 | KeyboardInterrupt
|
|---|
| 23 | >>>
|
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 | ###################
|
|---|
| 27 | ###################
|
|---|
| 28 | AFTER I MADE THE CHANGE PROPOSED IN MY ATTACHED PATCH
|
|---|
| 29 | ###################
|
|---|
| 30 | ###################
|
|---|
| 31 |
|
|---|
| 32 |
|
|---|
| 33 |
|
|---|
| 34 | bash-3.2$ python manage.py shell
|
|---|
| 35 | Python 2.6.5 (r265:79063, Sep 20 2011, 08:38:57)
|
|---|
| 36 | [GCC 4.0.1 (Apple Computer, Inc. build 5250)] on darwin
|
|---|
| 37 | Type "help", "copyright", "credits" or "license" for more information.
|
|---|
| 38 | (InteractiveConsole)
|
|---|
| 39 | >>> from V1API.models import *
|
|---|
| 40 | >>> Leaderboard.objects.distinct('DEVICEID').values('DEVICEID').count()
|
|---|
| 41 | 175
|
|---|
| 42 | >>>
|
|---|
| 43 | KeyboardInterrupt
|
|---|
| 44 | >>>
|
|---|
| 45 |
|
|---|
| 46 |
|
|---|
| 47 | bash-3.2$ python manage.py version
|
|---|
| 48 | 1.4
|
|---|
| 49 |
|
|---|