{"action":"opened","issue":{"url":"https://api.github.com/repos/lukaszb/django-guardian/issues/298","labels_url":"https://api.github.com/repos/lukaszb/django-guardian/issues/298/labels{/name}","comments_url":"https://api.github.com/repos/lukaszb/django-guardian/issues/298/comments","events_url":"https://api.github.com/repos/lukaszb/django-guardian/issues/298/events","html_url":"https://github.com/lukaszb/django-guardian/issues/298","id":58846974,"number":298,"title":"insert or update on table \"guardian_userobjectpermission\" violates foreign key constraint","user":{"login":"brechmos","id":887675,"avatar_url":"https://avatars.githubusercontent.com/u/887675?v=3","gravatar_id":"","url":"https://api.github.com/users/brechmos","html_url":"https://github.com/brechmos","followers_url":"https://api.github.com/users/brechmos/followers","following_url":"https://api.github.com/users/brechmos/following{/other_user}","gists_url":"https://api.github.com/users/brechmos/gists{/gist_id}","starred_url":"https://api.github.com/users/brechmos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brechmos/subscriptions","organizations_url":"https://api.github.com/users/brechmos/orgs","repos_url":"https://api.github.com/users/brechmos/repos","events_url":"https://api.github.com/users/brechmos/events{/privacy}","received_events_url":"https://api.github.com/users/brechmos/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-02-25T04:00:09Z","updated_at":"2015-02-25T04:00:09Z","closed_at":null,"body":"I am attempting to use guardian with my own User model.  Yes, I know, there is no guarantee guardian is going to work with another User model :-).  But I would appreciate any help in attempting to understand this to see if I can get this going.  \r\n\r\nI am getting an error when calling assign_perm('tab.view_tab', mem, ttt).\r\n\r\n    IntegrityError: insert or update on table \"guardian_userobjectpermission\" violates foreign key constraint \"guardian_userobjectpermission_user_id_fkey\"\r\n    DETAIL:  Key (user_id)=(67) is not present in table \"member_member\".\r\n\r\nthe \"mem\" Member (ie user) has and id of 67, so that is correct. member_member appears to be correct.  \r\n\r\nThe top part of the traceback is:\r\n\r\n       In [14]: assign_perm('tab.view_tab', mem, ttt)                                                                                                                             \r\n        ---------------------------------------------------------------------------\r\n        IntegrityError                            Traceback (most recent call last) \r\n        <ipython-input-14-fbd245913aef> in <module>()\r\n        ----> 1 assign_perm('tab.view_tab', mem, ttt)\r\n\r\n    <dir>/env/local/lib/python2.7/site-packages/guardian/shortcuts.pyc in assign_perm(perm, user_or_group, obj)\r\n         89     if user:\r\n         90         model = get_user_obj_perms_model(obj)    \r\n    ---> 91         return model.objects.assign_perm(perm, user, obj)\r\n         92     if group:\r\n         93         model = get_group_obj_perms_model(obj)\r\n\r\n   <dir>/env/local/lib/python2.7/site-packages/guardian/managers.pyc in assign_perm(self, perm, user, obj)\r\n         39         else:\r\n         40             kwargs['content_object'] = obj\r\n    ---> 41         obj_perm, created = self.get_or_create(**kwargs)\r\n         42         return obj_perm\r\n         43\r\n\r\n    <dir>/env/local/lib/python2.7/site-packages/django/db/models/manager.pyc in manager_method(self, *args, **kwargs)\r\n         90         def create_method(name, method):\r\n         91             def manager_method(self, *args, **kwargs):\r\n    ---> 92                 return getattr(self.get_queryset(), name)(*args, **kwargs)\r\n         93             manager_method.__name__ = method.__name__\r\n         94             manager_method.__doc__ = method.__doc__\r\n\r\nI assume some people have got django-guardian working with other user models, so I want to see what I can change in mine to make this work.  But, admittedly, I am stuck.\r\nThanks!"}}