#1796: [patch] "Cannot resolve keyword ___ into field" error when working with
ManyToMany relation
-------------------------+--------------------------------------------------
Reporter: anonymous | Owner: mtredinnick
Status: reopened | Component: Database wrapper
Version: SVN | Resolution:
Keywords: | Stage: Accepted
Has_patch: 1 | Needs_docs: 0
Needs_tests: 0 | Needs_better_patch: 0
-------------------------+--------------------------------------------------
Comment (by Yann VR):
I've uncommented the line Øyvind indicated but same problem for me.
It works fine using the shell, (reqroute_proto is the m2m key):
{{{
>>> from mt.models import MtReqroute
>>> entry=MtReqroute.objects.get(pk=1)
>>> entry.reqroute_proto.all()
[<MtProto: MGCP>, <MtProto: H.323>]
}}}
Now on the server, trying to retrieve the data through
a flattened manipulator:
Fails "Cannot resolve keyword 'mtreqroute' into field"
{{{
Traceback (most recent call last):
File "/home/yannvr/C4/django/core/handlers/base.py" in get_response
77. response = callback(request, *callback_args, **callback_kwargs)
File "/home/yannvr/C4/django/contrib/auth/decorators.py" in _checklogin
14. return view_func(request, *args, **kwargs)
File "/var/www/MT/mt/views/routes.py" in edit_route
54. new_data = manipulator.flatten_data()
File "/home/yannvr/C4/django/db/models/manipulators.py" in flatten_data
248. new_data.update(f.flatten_data(fol, obj))
File "/home/yannvr/C4/django/db/models/fields/related.py" in flatten_data
700. instance_ids = [instance._get_pk_val() for instance in getattr(obj,
self.name).all()]
File "/var/www/MT/django/db/models/query.py" in __iter__
108. return iter(self._get_data())
File "/var/www/MT/django/db/models/query.py" in _get_data
470. self._result_cache = list(self.iterator())
File "/var/www/MT/django/db/models/query.py" in iterator
174. select, sql, params = self._get_sql_clause()
File "/var/www/MT/django/db/models/query.py" in _get_sql_clause
484. joins2, where2, params2 = self._filters.get_sql(opts)
File "/var/www/MT/django/db/models/query.py" in get_sql
648. joins2, where2, params2 = val.get_sql(opts)
File "/var/www/MT/django/db/models/query.py" in get_sql
699. return parse_lookup(self.kwargs.items(), opts)
File "/var/www/MT/django/db/models/query.py" in parse_lookup
833. joins2, where2, params2 = lookup_inner(path, lookup_type, value,
opts, opts.db_table, None)
File "/var/www/MT/django/db/models/query.py" in lookup_inner
940. raise TypeError, "Cannot resolve keyword '%s' into field" % name
}}}
The middleware running on my server are:
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.middleware.doc.XViewMiddleware',
)
The moment is goes wrong is when trying to lookup
for that field
{{{
File "/var/www/MT/django/db/models/query.py" in __iter__
108. return iter(self._get_data())
self= Error in formatting:Cannot resolve keyword 'mtreqroute' into field
}}}
--
Ticket URL: <http://code.djangoproject.com/ticket/1796#comment:58>
Django Code <http://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 post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---