﻿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
28328	QuerySet.only doesn't work with QuerySet.difference	Dmitry Dygalo	nobody	"**models.py**:


{{{
class Model(models.Model):
    description = models.CharField(max_length=255)
}}}

**Actual behavior**:

{{{
>>> to_remove = Model.objects.filter(description='TO_REMOVE')
>>> query_set = Model.objects.all().difference(to_remove).only('pk')
>>> print(query_set.query)
(SELECT ""test_model"".""id"", ""test_model"".""description"" FROM ""test_model"") EXCEPT (SELECT ""test_model"".""id"", ""test_model"".""description"" FROM ""test_model"" WHERE ""test_model"".""description"" = TO_REMOVE)
}}}

**Expected**:

{{{
>>> to_remove = Model.objects.filter(description='TO_REMOVE')
>>> query_set = Model.objects.all().difference(to_remove).only('pk')
>>> print(query_set.query)
(SELECT ""test_model"".""id"" FROM ""test_model"") EXCEPT (SELECT ""test_model"".""id"", ""test_model"".""description"" FROM ""test_model"" WHERE ""test_model"".""description"" = TO_REMOVE)
}}}

**The problem**:
Even if I use `.only('pk')` there is still ""description"" column in SELECT in the query, but I expect only ""id"" field as was specified in `only`. "	Bug	closed	Database layer (models, ORM)	1.11	Normal	invalid			Unreviewed	0	0	0	0	0	0
