#11890: Defer/only + annotate is broken
------------------------------------------+---------------------------------
Reporter: [email protected] | Owner: nobody
Status: new | Milestone:
Component: Database layer (models, ORM) | Version: 1.1
Keywords: | Stage: Unreviewed
Has_patch: 0 |
------------------------------------------+---------------------------------
If you use defer or only + annotate, the ORM returns an empty list. To
replicate this:
{{{
class Manufacturer(models.Model):
name = models.CharField(max_length=64)
country = models.CharField(max_length=32)
class Car(models.Model):
manufacturer = models.ForeignKey(Manufacturer, related_name='models')
>>>Manufacturer.objects.only('name').annotate(Count('models'))
>>>[]
}}}
This is due to a typo in django.db.models.sql.query at line 714.
The existing code:
{{{ if table in only_load and col not in only_load[table]: }}}
should read
{{{ if table in only_load and column not in only_load[table]:}}}
--
Ticket URL: <http://code.djangoproject.com/ticket/11890>
Django <http://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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---