#29272: Queryset using order_by(F()) fails to compile with values_list -------------------------------------+------------------------------------- Reporter: bszfw | Owner: nobody Type: Bug | Status: closed Component: Database layer | Version: 2.0 (models, ORM) | Severity: Normal | Resolution: duplicate Keywords: | Triage Stage: | Unreviewed Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+------------------------------------- Changes (by Tim Graham):
* status: new => closed * resolution: => duplicate Comment: The traceback: {{{ Traceback (most recent call last): File "<console>", line 1, in <module> File "django/db/models/query.py", line 248, in __repr__ data = list(self[:REPR_OUTPUT_SIZE + 1]) File "django/db/models/query.py", line 272, in __iter__ self._fetch_all() File "django/db/models/query.py", line 1179, in _fetch_all self._result_cache = list(self._iterable_class(self)) File "django/db/models/query.py", line 138, in __iter__ return compiler.results_iter(tuple_expected=True, chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size) File "django/db/models/sql/compiler.py", line 1018, in results_iter results = self.execute_sql(MULTI, chunked_fetch=chunked_fetch, chunk_size=chunk_size) File "django/db/models/sql/compiler.py", line 1054, in execute_sql sql, params = self.as_sql() File "django/db/models/sql/compiler.py", line 447, in as_sql extra_select, order_by, group_by = self.pre_sql_setup() File "django/db/models/sql/compiler.py", line 51, in pre_sql_setup order_by = self.get_order_by() File "django/db/models/sql/compiler.py", line 346, in get_order_by self.query, allow_joins=True, reuse=None) File "django/db/models/expressions.py", line 248, in resolve_expression for expr in c.get_source_expressions() File "django/db/models/expressions.py", line 248, in <listcomp> for expr in c.get_source_expressions() File "django/db/models/expressions.py", line 516, in resolve_expression return query.resolve_ref(self.name, allow_joins, reuse, summarize) File "django/db/models/sql/query.py", line 1518, in resolve_ref return self.annotation_select[name] KeyError: 'test' }}} Duplicate of #28811 which will be fixed in Django 2.1. -- Ticket URL: <https://code.djangoproject.com/ticket/29272#comment:2> 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 unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/063.bfaccefecf10d52ce76ec72ab2bf474f%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.