Skip to content

Commit

Permalink
Merge 6241395 into 0001c47
Browse files Browse the repository at this point in the history
  • Loading branch information
DAV3HIT3 committed Oct 8, 2014
2 parents 0001c47 + 6241395 commit 44ff24b
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions simple_history/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,11 @@ def get_field(self, other, cls):
if isinstance(to_field, models.OneToOneField):
field = self.get_one_to_one_field(to_field, other)
elif isinstance(to_field, models.AutoField):
field.__class__ = models.IntegerField
# Check if AutoField is string for django-non-rel support
if isinstance(field, models.TextField):
field.__class__ = models.TextField
else:
field.__class__ = models.IntegerField
else:
field.__class__ = to_field.__class__
excluded_prefixes = ("_", "__")
Expand Down Expand Up @@ -319,7 +323,12 @@ def transform_field(field):
if isinstance(field, models.AutoField):
# The historical model gets its own AutoField, so any
# existing one must be replaced with an IntegerField.
field.__class__ = models.IntegerField
if isinstance(field, models.TextField):
# Check if AutoField is string for django-non-rel support
field.__class__ = models.TextField
else:
field.__class__ = models.IntegerField

elif isinstance(field, models.FileField):
# Don't copy file, just path.
field.__class__ = models.TextField
Expand Down

0 comments on commit 44ff24b

Please sign in to comment.