{"action":"created","issue":{"url":"https://api.github.com/repos/dfunckt/django-rules/issues/39","repository_url":"https://api.github.com/repos/dfunckt/django-rules","labels_url":"https://api.github.com/repos/dfunckt/django-rules/issues/39/labels{/name}","comments_url":"https://api.github.com/repos/dfunckt/django-rules/issues/39/comments","events_url":"https://api.github.com/repos/dfunckt/django-rules/issues/39/events","html_url":"https://github.com/dfunckt/django-rules/issues/39","id":176474405,"number":39,"title":"Making rules work with CreateView","user":{"login":"bcoover","id":1980315,"avatar_url":"https://avatars.githubusercontent.com/u/1980315?v=3","gravatar_id":"","url":"https://api.github.com/users/bcoover","html_url":"https://github.com/bcoover","followers_url":"https://api.github.com/users/bcoover/followers","following_url":"https://api.github.com/users/bcoover/following{/other_user}","gists_url":"https://api.github.com/users/bcoover/gists{/gist_id}","starred_url":"https://api.github.com/users/bcoover/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bcoover/subscriptions","organizations_url":"https://api.github.com/users/bcoover/orgs","repos_url":"https://api.github.com/users/bcoover/repos","events_url":"https://api.github.com/users/bcoover/events{/privacy}","received_events_url":"https://api.github.com/users/bcoover/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2016-09-12T20:22:06Z","updated_at":"2016-09-22T20:11:21Z","closed_at":"2016-09-22T19:58:52Z","body":"Not sure this is really an issue, but good for your documentation:\r\nBy default I have found rules don't work with CreateView because there is no object instance yet, so it throws a PK error. However, I have defined rules as such that will accept just the user object and will return the appropriate True/False. I really needed some security rules on the CreateView, so I started messing with the get_object function (unused for CreateView) and I made this work by adding the following function '**get_object**' to the CreateView class:\r\n\r\n`\r\nclass CustomCreateView(PermissionRequiredMixin, CreateView):\r\n    \"\"\" other stuff \"\"\"\r\n    def get_object(self):\r\n        pass\r\n`\r\n\r\nNow I'm trying to get this working with ListView, which is proving to be a bit more difficult...\r\n"},"comment":{"url":"https://api.github.com/repos/dfunckt/django-rules/issues/comments/249014377","html_url":"https://github.com/dfunckt/django-rules/issues/39#issuecomment-249014377","issue_url":"https://api.github.com/repos/dfunckt/django-rules/issues/39","id":249014377,"user":{"login":"bcoover","id":1980315,"avatar_url":"https://avatars.githubusercontent.com/u/1980315?v=3","gravatar_id":"","url":"https://api.github.com/users/bcoover","html_url":"https://github.com/bcoover","followers_url":"https://api.github.com/users/bcoover/followers","following_url":"https://api.github.com/users/bcoover/following{/other_user}","gists_url":"https://api.github.com/users/bcoover/gists{/gist_id}","starred_url":"https://api.github.com/users/bcoover/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bcoover/subscriptions","organizations_url":"https://api.github.com/users/bcoover/orgs","repos_url":"https://api.github.com/users/bcoover/repos","events_url":"https://api.github.com/users/bcoover/events{/privacy}","received_events_url":"https://api.github.com/users/bcoover/received_events","type":"User","site_admin":false},"created_at":"2016-09-22T20:11:21Z","updated_at":"2016-09-22T20:11:21Z","body":"Thanks!"}}
{"actor":{"display_login":"bcoover"}}