don't store created pks as int

This commit is contained in:
Laura Klünder 2017-06-22 22:47:22 +02:00
parent c6ed3105b0
commit f1854c8b66
4 changed files with 21 additions and 26 deletions

View file

@ -65,14 +65,12 @@ class Change(models.Model):
@property
def obj_pk(self) -> typing.Union[int, str]:
if self._set_object is not None:
return self._set_object.pk
if self.existing_object_pk is not None:
return self.existing_object_pk
if self.created_object_id is not None:
return 'c'+str(self.created_object_id)
if self.action == 'create':
return 'c' + str(self.pk)
return 'c'+str(self.pk)
raise TypeError('existing_model_pk or created_object have to be set.')
def other_changes(self):