#16409: `defer()` and `only()` don't play nice with `annotate()`
-------------------------------------+-------------------------------------
               Reporter:  mrmachine  |          Owner:  nobody
                   Type:  Bug        |         Status:  new
              Milestone:  1.4        |      Component:  Database layer
                Version:  SVN        |  (models, ORM)
             Resolution:             |       Severity:  Normal
           Triage Stage:             |       Keywords:  annotate defer only
  Unreviewed                         |  count
    Needs documentation:  0          |      Has patch:  1
Patch needs improvement:  1          |    Needs tests:  0
                  UI/UX:  0          |  Easy pickings:  0
-------------------------------------+-------------------------------------
Changes (by mrmachine):

 * needs_docs:   => 0
 * has_patch:  0 => 1
 * needs_tests:   => 0
 * needs_better_patch:   => 1


Comment:

 Added a patch with a failing test case.

 {{{
 Creating test database for alias 'default'...
 Creating test database for alias 'other'...
 E
 ======================================================================
 ERROR: test_defer (modeltests.defer.tests.DeferTests)
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File
 "/Users/mrmachine/Subversion/django/tests/modeltests/defer/tests.py", line
 141, in test_defer
 
self.assertEqual(len(Secondary.objects.annotate(Count('primary')).defer('first')),
 1)
   File "/Users/mrmachine/Subversion/django/django/db/models/query.py",
 line 82, in __len__
     self._result_cache = list(self.iterator())
   File "/Users/mrmachine/Subversion/django/django/db/models/query.py",
 line 300, in iterator
     setattr(obj, aggregate, row[i+aggregate_start])
 IndexError: tuple index out of range

 ----------------------------------------------------------------------
 Ran 1 test in 0.120s

 FAILED (errors=1)
 Destroying test database for alias 'default'...
 Destroying test database for alias 'other'...
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/16409#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to