mirror of
https://github.com/jazzband/django-auditlog.git
synced 2026-03-16 22:20:26 +00:00
- Check for model using isinstance
- Check for model using isinstance and pk using _get_pk_value
This commit is contained in:
parent
16a55e1924
commit
cc2e489f75
1 changed files with 3 additions and 3 deletions
|
|
@ -65,9 +65,9 @@ class LogEntryManager(models.Manager):
|
|||
pk_field = instance._meta.pk.name
|
||||
pk = getattr(instance, pk_field, None)
|
||||
|
||||
# Check to make sure that we got an pk not a class object.
|
||||
if hasattr(pk, '_meta'):
|
||||
pk = getattr(instance, '%s_id' % pk_field, None)
|
||||
# Check to make sure that we got an pk not a model object.
|
||||
if isinstance(pk, models.Model):
|
||||
pk = self._get_pk_value(pk)
|
||||
return pk
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue