Django orm "annotate" not working with "only"

I want to select only one column with "only" and rename it.

The code I want in SQLServer is as follows:

 SELECT [table].[col1] AS [new_col1] FROM [table]

in django orm:

 model.objects.annotate(new_col1=F('col1').only('col1')).all()

When i change it to sql query it is like this:

 SELECT [table].[col1], [table].[col1] AS [new_col1] FROM [table]

and below orm code not working:

 model.objects.annotate(new_col1=F('col1').only('new_col1')).all()

I don't want to use "values" or "values_list".

Please help me how I can do it.

Back to Top