{"action":"created","issue":{"url":"https://api.github.com/repos/Atomidata/django-audit-log/issues/24","labels_url":"https://api.github.com/repos/Atomidata/django-audit-log/issues/24/labels{/name}","comments_url":"https://api.github.com/repos/Atomidata/django-audit-log/issues/24/comments","events_url":"https://api.github.com/repos/Atomidata/django-audit-log/issues/24/events","html_url":"https://github.com/Atomidata/django-audit-log/issues/24","id":73208959,"number":24,"title":"action_user created with incorrect to= model","user":{"login":"brianmay","id":112729,"avatar_url":"https://avatars.githubusercontent.com/u/112729?v=3","gravatar_id":"","url":"https://api.github.com/users/brianmay","html_url":"https://github.com/brianmay","followers_url":"https://api.github.com/users/brianmay/followers","following_url":"https://api.github.com/users/brianmay/following{/other_user}","gists_url":"https://api.github.com/users/brianmay/gists{/gist_id}","starred_url":"https://api.github.com/users/brianmay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brianmay/subscriptions","organizations_url":"https://api.github.com/users/brianmay/orgs","repos_url":"https://api.github.com/users/brianmay/repos","events_url":"https://api.github.com/users/brianmay/events{/privacy}","received_events_url":"https://api.github.com/users/brianmay/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-05-05T04:58:30Z","updated_at":"2015-05-06T04:12:03Z","closed_at":null,"body":"Hello,\r\n\r\nI have in my Django settings file:\r\n\r\n```python\r\nAUTH_USER_MODEL = 'karaage.Person'\r\n```\r\n\r\nIf I try to update this model to use django-audit-log, it gives me a migration containing the following field:\r\n\r\n```\r\n('action_user', audit_log.models.fields.LastUserField(related_name='_person_audit_log_entry', editable=False, to='karaage.PersonAuditLogEntry', null=True)),\r\n```\r\n\r\nHowever, this is incorrect, it should point to karaage.Person, like for the other tables, eg:\r\n\r\n```python\r\n('action_user', audit_log.models.fields.LastUserField(to='karaage.Person', null=True, editable=False, related_name='_projectlevel_audit_log_entry')),\r\n```\r\n\r\nThis results in errors such as the following one:\r\n\r\n```python\r\n  File \"/home/brian/tree/karaage/karaage-working/karaage/people/models.py\", line 137, in save\r\n    super(Person, self).save(*args, **kwargs)\r\n  File \"/usr/lib/python3/dist-packages/django/db/models/base.py\", line 589, in save\r\n    force_update=force_update, update_fields=update_fields)\r\n  File \"/usr/lib/python3/dist-packages/django/db/models/base.py\", line 626, in save_base\r\n    update_fields=update_fields, raw=raw, using=using)\r\n  File \"/usr/lib/python3/dist-packages/django/dispatch/dispatcher.py\", line 198, in send\r\n    response = receiver(signal=self, sender=sender, **named)\r\n  File \"/usr/lib/python3/dist-packages/audit_log/models/managers.py\", line 107, in post_save\r\n    self.create_log_entry(instance, created and 'I' or 'U')\r\n  File \"/usr/lib/python3/dist-packages/audit_log/models/managers.py\", line 102, in create_log_entry\r\n    manager.create(action_type = action_type, **attrs)\r\n  File \"/usr/lib/python3/dist-packages/django/db/models/manager.py\", line 92, in manager_method\r\n    return getattr(self.get_queryset(), name)(*args, **kwargs)\r\n  File \"/usr/lib/python3/dist-packages/django/db/models/query.py\", line 372, in create\r\n    obj.save(force_insert=True, using=self.db)\r\n  File \"/usr/lib/python3/dist-packages/django/db/models/base.py\", line 589, in save\r\n    force_update=force_update, update_fields=update_fields)\r\n  File \"/usr/lib/python3/dist-packages/django/db/models/base.py\", line 613, in save_base\r\n    update_fields=update_fields)\r\n  File \"/usr/lib/python3/dist-packages/django/dispatch/dispatcher.py\", line 198, in send\r\n    response = receiver(signal=self, sender=sender, **named)\r\n  File \"/usr/lib/python3/dist-packages/django/utils/functional.py\", line 17, in _curried\r\n    return _curried_func(*(args + moreargs), **dict(kwargs, **morekwargs))\r\n  File \"/usr/lib/python3/dist-packages/audit_log/middleware.py\", line 51, in _update_pre_save_info\r\n    setattr(instance, field.name, user)\r\n  File \"/usr/lib/python3/dist-packages/django/db/models/fields/related.py\", line 597, in __set__\r\n    self.field.rel.to._meta.object_name,\r\nValueError: Cannot assign \"<SimpleLazyObject: <Person: Test User1>>\": \"PersonAuditLogEntry.action_user\" must be a \"PersonAuditLogEntry\" instance.\r\n```\r\n\r\nAny ideas?\r\n\r\nRegards"},"comment":{"url":"https://api.github.com/repos/Atomidata/django-audit-log/issues/comments/99316201","html_url":"https://github.com/Atomidata/django-audit-log/issues/24#issuecomment-99316201","issue_url":"https://api.github.com/repos/Atomidata/django-audit-log/issues/24","id":99316201,"user":{"login":"brianmay","id":112729,"avatar_url":"https://avatars.githubusercontent.com/u/112729?v=3","gravatar_id":"","url":"https://api.github.com/users/brianmay","html_url":"https://github.com/brianmay","followers_url":"https://api.github.com/users/brianmay/followers","following_url":"https://api.github.com/users/brianmay/following{/other_user}","gists_url":"https://api.github.com/users/brianmay/gists{/gist_id}","starred_url":"https://api.github.com/users/brianmay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brianmay/subscriptions","organizations_url":"https://api.github.com/users/brianmay/orgs","repos_url":"https://api.github.com/users/brianmay/repos","events_url":"https://api.github.com/users/brianmay/events{/privacy}","received_events_url":"https://api.github.com/users/brianmay/received_events","type":"User","site_admin":false},"created_at":"2015-05-06T04:12:03Z","updated_at":"2015-05-06T04:12:03Z","body":"Oddly enough, e6781837267773bba25338fe33f9198e235bf26b changes the behaviour so that an error is generated instead:\r\n\r\n```\r\nkaraage.PersonAuditLogEntry.action_user: (fields.E300) Field defines a relation with model 'karaage.Person', which is either not installed, or is abstract.\r\n```\r\n\r\nWhich is odd, I don't see anything in this commit which would have had such a significant change.\r\n\r\nStill investigating..."}}