Skip to content

Commit

Permalink
Expose instance model to complete related historical fields
Browse files Browse the repository at this point in the history
  • Loading branch information
macro1 committed Aug 7, 2014
1 parent 330c7bd commit 2932d7a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion simple_history/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ def get_instance(self):
)),
'history_object': HistoricalObjectDescriptor(model),
'instance': property(get_instance),
'instance_type': model,
'revert_url': revert_url,
'__str__': lambda self: '%s as of %s' % (self.history_object,
self.history_date)
Expand Down Expand Up @@ -283,7 +284,7 @@ def get_field(self, other, cls):
def do_related_class(self, other, cls):
field = self.get_field(other, cls)
if not hasattr(self, 'related'):
self.related = RelatedObject(other, self.rel.field.model, self)
self.related = RelatedObject(other, cls.instance_type, self)
transform_field(field)
field.rel = None

Expand Down

0 comments on commit 2932d7a

Please sign in to comment.