Opened 11 years ago
Closed 11 years ago
#22339 closed Uncategorized (invalid)
accessing m2m relation where database is not 'default' throws error
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 1.7-beta-1 |
Severity: | Release blocker | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Giving two models
like here : https://docs.djangoproject.com/en/dev/topics/db/examples/many_to_many/
with m2m relation located on single database which is configured with a different alias then 'default'
Accessing relation a1.publications.all() throws error:
Traceback (most recent call last): File "<input>", line 1, in <module> File "/home/mars/dev/ve/v3/lib/python3.3/site-packages/django/db/models/manager.py", line 191, in all return self.get_queryset() File "/home/mars/dev/ve/v3/lib/python3.3/site-packages/django/db/models/fields/related.py", line 874, in get_queryset return qs._next_is_sticky().filter(**self.core_filters) File "/home/mars/dev/ve/v3/lib/python3.3/site-packages/django/db/models/query.py", line 686, in filter return self._filter_or_exclude(False, *args, **kwargs) File "/home/mars/dev/ve/v3/lib/python3.3/site-packages/django/db/models/query.py", line 704, in _filter_or_exclude clone.query.add_q(Q(*args, **kwargs)) File "/home/mars/dev/ve/v3/lib/python3.3/site-packages/django/db/models/sql/query.py", line 1284, in add_q clause, require_inner = self._add_q(where_part, self.used_aliases) File "/home/mars/dev/ve/v3/lib/python3.3/site-packages/django/db/models/sql/query.py", line 1311, in _add_q current_negated=current_negated, connector=connector) File "/home/mars/dev/ve/v3/lib/python3.3/site-packages/django/db/models/sql/query.py", line 1138, in build_filter lookups, parts, reffed_aggregate = self.solve_lookup_type(arg) File "/home/mars/dev/ve/v3/lib/python3.3/site-packages/django/db/models/sql/query.py", line 1076, in solve_lookup_type _, field, _, lookup_parts = self.names_to_path(lookup_splitted, self.get_meta()) File "/home/mars/dev/ve/v3/lib/python3.3/site-packages/django/db/models/sql/query.py", line 1380, in names_to_path self.raise_field_error(opts, name) File "/home/mars/dev/ve/v3/lib/python3.3/site-packages/django/db/models/sql/query.py", line 1386, in raise_field_error "Choices are: %s" % (name, ", ".join(available))) django.core.exceptions.FieldError: Cannot resolve keyword 'article' choices are ....
Change History (3)
comment:1 by , 11 years ago
comment:2 by , 11 years ago
Severity: | Normal → Release blocker |
---|
I don't have time to check this just now, but I'll mark this as a release blocker so that this will not be missed.
If possible, a small sample project or code for models + would help a lot in debugging this, from the description I am not exactly sure how to reproduce this.
comment:3 by , 11 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
I've done some testing on clean install and the problem seems to be elsewhere. I can confirm the relation m2m lookups work as expected. I going to close this ticket and file another one if im able to pinpoint the bug mode precisely. Simple reinstall from ver. 1.6.2 to 1.7 causes the code to fall but at the moment it's not clear to me where the problem is ...
I've forgotten to add that this works in django 1.6.2 and stops working in django 1.7beta and current git master