Skip to content

Commit 8b22681

Browse files
committed
Fetch pre-1.6 to_field from rel field object itself
1 parent fce7720 commit 8b22681

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

simple_history/models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@ def copy_fields(self, model):
146146
field_arguments['db_constraint'] = False
147147
if getattr(old_field, 'to_fields', []):
148148
field_arguments['to_field'] = old_field.to_fields[0]
149-
elif django.get_version() == "1.4" and getattr(old_field, 'to_field', None):
150-
field_arguments['to_field'] = old_field.to_field
149+
elif django.get_version() < "1.6" and old_field.rel.field_name != 'id':
150+
field_arguments['to_field'] = old_field.rel.field_name
151151
field = FieldType(
152152
old_field.rel.to,
153153
related_name='+',

0 commit comments

Comments
 (0)