﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
11890	Defer/only + annotate is broken	jaklaassen@…	ruosteinen	"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]:}}}

"	Bug	closed	Database layer (models, ORM)	dev	Normal	fixed		milos.urbanek@…	Accepted	1	0	0	1	0	0
