treyhunner/django-simple-history — pull request #109 by treyhunner (2014-08-01 01:27:48+00:00)
Title: Fix bug with related

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'