FieldError with keywords in modeltests.lookup

Issue #55 resolved
Johan Harjono created an issue

{{{

!python

File "/home/johan/workspace/fiji/build/tests/modeltests/lookup/models.py", line ?, in modeltests.lookup.models.test.API_TESTS Failed example: Article.objects.extra(select={'id_plus_one': 'id + 1'}).values('id', 'id_plus_two') Expected: Traceback (most recent call last): ... FieldError: Cannot resolve keyword 'id_plus_two' into field. Choices are: headline, id, id_plus_one, pub_date Got: Traceback (most recent call last): File "/usr/local/lib/python3.1/dist-packages/django/db/models/options.py", line 293, in get_field_by_name return self._name_map[name] KeyError: 'id_plus_two' <BLANKLINE> During handling of the above exception, another exception occurred: <BLANKLINE> Traceback (most recent call last): File "/usr/local/lib/python3.1/dist-packages/django/db/models/sql/query.py", line 1151, in setup_joins field, model, direct, m2m = opts.get_field_by_name(name) File "/usr/local/lib/python3.1/dist-packages/django/db/models/options.py", line 299, in get_field_by_name % (self.object_name, name)) django.db.models.fields.FieldDoesNotExist: Article has no field named 'id_plus_two' <BLANKLINE> During handling of the above exception, another exception occurred: <BLANKLINE> Traceback (most recent call last): File "/usr/local/lib/python3.1/dist-packages/django/db/models/sql/query.py", line 1466, in add_fields True) File "/usr/local/lib/python3.1/dist-packages/django/db/models/sql/query.py", line 1163, in setup_joins "Choices are: %s" % (name, ", ".join(names))) django.core.exceptions.FieldError: Cannot resolve keyword 'id_plus_two' into field. Choices are: headline, id, pub_date <BLANKLINE> During handling of the above exception, another exception occurred: <BLANKLINE> Traceback (most recent call last): File "/usr/local/lib/python3.1/dist-packages/django/test/_doctest.py", line 1307, in run compileflags, 1), test.globs) File "<doctest modeltests.lookup.models.test__.API_TESTS[51]>", line 1, in <module> Article.objects.extra(select={'id_plus_one': 'id + 1'}).values('id', 'id_plus_two') File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 499, in values return self._clone(klass=ValuesQuerySet, setup=True, _fields=fields) File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 744, in _clone c._setup_query() File "/usr/local/lib/python3.1/dist-packages/django/db/models/query.py", line 867, in _setup_query self.query.add_fields(self.field_names, False) File "/usr/local/lib/python3.1/dist-packages/django/db/models/sql/query.py", line 1485, in add_fields "Choices are: %s" % (name, ", ".join(names))) django.core.exceptions.FieldError: Cannot resolve keyword 'id_plus_two' into field. Choices are: headline, id, id_plus_one, pub_date }}}

Comments (2)

  1. Log in to comment