Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #7791 -- Fixed a really silly error I introduced in [7926]. :-(

git-svn-id: http://code.djangoproject.com/svn/django/trunk@8052 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 83e97ecf885676f29170ee036ca210d28dfe19fb 1 parent 0e9587f
Malcolm Tredinnick authored July 22, 2008
5  django/db/models/sql/query.py
@@ -1616,8 +1616,9 @@ def execute_sql(self, result_type=MULTI):
1616 1616
         if self.ordering_aliases:
1617 1617
             result = order_modified_iter(cursor, len(self.ordering_aliases),
1618 1618
                     self.connection.features.empty_fetchmany_value)
1619  
-        result = iter((lambda: cursor.fetchmany(GET_ITERATOR_CHUNK_SIZE)),
1620  
-                self.connection.features.empty_fetchmany_value)
  1619
+        else:
  1620
+            result = iter((lambda: cursor.fetchmany(GET_ITERATOR_CHUNK_SIZE)),
  1621
+                    self.connection.features.empty_fetchmany_value)
1621 1622
         if not self.connection.features.can_use_chunked_reads:
1622 1623
             # If we are using non-chunked reads, we return the same data
1623 1624
             # structure as normally, but ensure it is all read into memory
5  tests/regressiontests/queries/models.py
@@ -822,6 +822,11 @@ class Related(models.Model):
822 822
 ...     break
823 823
 True
824 824
 
  825
+Bug #7791 -- there were "issues" when ordering and distinct-ing on fields
  826
+related via ForeignKeys.
  827
+>>> Note.objects.order_by('extrainfo__info').distinct()
  828
+[<Note: n3>, <Note: n1>, <Note: n2>]
  829
+
825 830
 """}
826 831
 
827 832
 # In Python 2.3, exceptions raised in __len__ are swallowed (Python issue

0 notes on commit 83e97ec

Please sign in to comment.
Something went wrong with that request. Please try again.