Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug with related #109

Merged
merged 4 commits into from
Aug 8, 2014
Merged

Fix bug with related #109

merged 4 commits into from
Aug 8, 2014

Conversation

treyhunner
Copy link
Member

Before I made this fix, I experienced this error when starting my app:

  File "/usr/local/lib/python2.7/site-packages/django/db/models/query.py", line 590, in filter
    return self._filter_or_exclude(False, *args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/django/db/models/query.py", line 608, in _filter_or_exclude
    clone.query.add_q(Q(*args, **kwargs))
  File "/usr/local/lib/python2.7/site-packages/django/db/models/sql/query.py", line 1198, in add_q
    clause = self._add_q(where_part, used_aliases)
  File "/usr/local/lib/python2.7/site-packages/django/db/models/sql/query.py", line 1234, in _add_q
    current_negated=current_negated)
  File "/usr/local/lib/python2.7/site-packages/django/db/models/sql/query.py", line 1100, in build_filter
    allow_explicit_fk=True)
  File "/usr/local/lib/python2.7/site-packages/django/db/models/sql/query.py", line 1357, in setup_joins
    names, opts, allow_many, allow_explicit_fk)
  File "/usr/local/lib/python2.7/site-packages/django/db/models/sql/query.py", line 1265, in names_to_path
    field, model, direct, m2m = opts.get_field_by_name(name)
  File "/usr/local/lib/python2.7/site-packages/django/db/models/options.py", line 373, in get_field_by_name
    cache = self.init_name_map()
  File "/usr/local/lib/python2.7/site-packages/django/db/models/options.py", line 404, in init_name_map
    for f, model in self.get_all_related_objects_with_model():
  File "/usr/local/lib/python2.7/site-packages/django/db/models/options.py", line 466, in get_all_related_objects_with_model
    self._fill_related_objects_cache()
  File "/usr/local/lib/python2.7/site-packages/django/db/models/options.py", line 494, in _fill_related_objects_cache
    cache[f.related] = None
AttributeError: 'CustomForeignKey' object has no attribute 'related'

@macro1
Copy link
Collaborator

macro1 commented Aug 2, 2014

I can't seem to reproduce it... Seems fairly sane though. I think it will be unnecessary in 1.7.

@treyhunner treyhunner mentioned this pull request Aug 6, 2014
@treyhunner
Copy link
Member Author

👍 the new changes look fine to me. I think it's ready to be merged.

@macro1 macro1 merged commit 2932d7a into master Aug 8, 2014
@treyhunner treyhunner deleted the fix-related-issue branch August 9, 2014 01:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants