Opened 18 years ago

Last modified 10 years ago

#1796 closed defect

"Cannot resolve keyword ___ into field" error when working with ManyToMany relation — at Initial Version

Reported by: anonymous Owned by: Adrian Holovaty
Component: Database layer (models, ORM) Version: dev
Severity: critical Keywords:
Cc: simon@…, gabor@…, Maniac@…, freakboy3742@…, tom@…, rbreathe@…, pawel.kowalak@…, v.oostveen@…, mir@…, rudolph.froger@…, jhmsmits@…, bon_jovina@…, virtel@…, django@…, deadwisdom@…, yannvr@… Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Any attempt to get the related objects from a many to many relation using all() fails. For example the line

a1.primary_categories.all()

in tests/modeltests/m2m_multiple fails with the following error:

Traceback (most recent call last):

File "<stdin>", line 1, in ?
File "C:\Python24\lib\site-packages\django\db\models\query.py", line 88, in

repr

return repr(self._get_data())

File "C:\Python24\lib\site-packages\django\db\models\query.py", line 378, in _

get_data

self._result_cache = list(self.iterator())

File "C:\Python24\lib\site-packages\django\db\models\query.py", line 159, in i

terator

select, sql, params = self._get_sql_clause()

File "C:\Python24\lib\site-packages\django\db\models\query.py", line 392, in _

get_sql_clause

tables2, joins2, where2, params2 = self._filters.get_sql(opts)

File "C:\Python24\lib\site-packages\django\db\models\query.py", line 523, in g

et_sql

tables2, joins2, where2, params2 = val.get_sql(opts)

File "C:\Python24\lib\site-packages\django\db\models\query.py", line 572, in g

et_sql

return parse_lookup(self.kwargs.items(), opts)

File "C:\Python24\lib\site-packages\django\db\models\query.py", line 677, in p

arse_lookup

tables2, joins2, where2, params2 = lookup_inner(path, clause, value, opts, o

pts.db_table, None)

File "C:\Python24\lib\site-packages\django\db\models\query.py", line 780, in l

ookup_inner

raise TypeError, "Cannot resolve keyword '%s' into field" % name

TypeError: Cannot resolve keyword 'primary_article_set' into field


      

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top