Skip to content

Commit 2932d7a

Browse files
committed
Expose instance model to complete related historical fields
1 parent 330c7bd commit 2932d7a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

simple_history/models.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ def get_instance(self):
182182
)),
183183
'history_object': HistoricalObjectDescriptor(model),
184184
'instance': property(get_instance),
185+
'instance_type': model,
185186
'revert_url': revert_url,
186187
'__str__': lambda self: '%s as of %s' % (self.history_object,
187188
self.history_date)
@@ -283,7 +284,7 @@ def get_field(self, other, cls):
283284
def do_related_class(self, other, cls):
284285
field = self.get_field(other, cls)
285286
if not hasattr(self, 'related'):
286-
self.related = RelatedObject(other, self.rel.field.model, self)
287+
self.related = RelatedObject(other, cls.instance_type, self)
287288
transform_field(field)
288289
field.rel = None
289290

0 commit comments

Comments
 (0)