{"action":"created","comment":{"url":"https://api.github.com/repos/druids/django-GDPR/pulls/comments/242305015","pull_request_review_id":185783236,"id":242305015,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI0MjMwNTAxNQ==","diff_hunk":"@@ -30,18 +30,32 @@ def create_from_purpose_slug(self, purpose_slug, source_object, issued_at=None,\n             raise KeyError('Purpose with slug {} does not exits'.format(purpose_slug))\n \n     def exists_valid_consent(self, purpose_slug, source_object):\n-        return LegalReason.objects.filter(\n-            source_object_content_type=ContentType.objects.get_for_model(source_object.__class__),\n-            source_object_id=str(source_object.pk),\n-            purpose_slug=purpose_slug,\n-            is_active=True,\n-            expires_at__gte=timezone.now(),\n-        ).exists()\n+        return LegalReason.objects.filter_source_instance_active_non_expired(\n+            source_object).filter(purpose_slug=purpose_slug).exists()\n+\n+\n+class LegalReasonQuerySet(models.QuerySet):\n+\n+    def filter_active(self):\n+        return self.filter(is_active=True)\n+\n+    def filter_non_expired(self):","path":"gdpr/models.py","position":20,"original_position":20,"commit_id":"605fdada768f6b72a86c4a0735457937668a0e0d","original_commit_id":"605fdada768f6b72a86c4a0735457937668a0e0d","user":{"login":"rubickcz","id":3601440,"node_id":"MDQ6VXNlcjM2MDE0NDA=","avatar_url":"https://avatars2.githubusercontent.com/u/3601440?v=4","gravatar_id":"","url":"https://api.github.com/users/rubickcz","html_url":"https://github.com/rubickcz","followers_url":"https://api.github.com/users/rubickcz/followers","following_url":"https://api.github.com/users/rubickcz/following{/other_user}","gists_url":"https://api.github.com/users/rubickcz/gists{/gist_id}","starred_url":"https://api.github.com/users/rubickcz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rubickcz/subscriptions","organizations_url":"https://api.github.com/users/rubickcz/orgs","repos_url":"https://api.github.com/users/rubickcz/repos","events_url":"https://api.github.com/users/rubickcz/events{/privacy}","received_events_url":"https://api.github.com/users/rubickcz/received_events","type":"User","site_admin":false},"body":"Myslíš že tohle někdo bude používat samostatně?","created_at":"2018-12-17T20:30:13Z","updated_at":"2018-12-17T20:31:26Z","html_url":"https://github.com/druids/django-GDPR/pull/6#discussion_r242305015","pull_request_url":"https://api.github.com/repos/druids/django-GDPR/pulls/6","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/druids/django-GDPR/pulls/comments/242305015"},"html":{"href":"https://github.com/druids/django-GDPR/pull/6#discussion_r242305015"},"pull_request":{"href":"https://api.github.com/repos/druids/django-GDPR/pulls/6"}}},"pull_request":{"url":"https://api.github.com/repos/druids/django-GDPR/pulls/6","id":238787300,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM4Nzg3MzAw","html_url":"https://github.com/druids/django-GDPR/pull/6","diff_url":"https://github.com/druids/django-GDPR/pull/6.diff","patch_url":"https://github.com/druids/django-GDPR/pull/6.patch","issue_url":"https://api.github.com/repos/druids/django-GDPR/issues/6","number":6,"state":"open","locked":false,"title":"Legal reason filters","user":{"login":"cedel1","id":841951,"node_id":"MDQ6VXNlcjg0MTk1MQ==","avatar_url":"https://avatars1.githubusercontent.com/u/841951?v=4","gravatar_id":"","url":"https://api.github.com/users/cedel1","html_url":"https://github.com/cedel1","followers_url":"https://api.github.com/users/cedel1/followers","following_url":"https://api.github.com/users/cedel1/following{/other_user}","gists_url":"https://api.github.com/users/cedel1/gists{/gist_id}","starred_url":"https://api.github.com/users/cedel1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cedel1/subscriptions","organizations_url":"https://api.github.com/users/cedel1/orgs","repos_url":"https://api.github.com/users/cedel1/repos","events_url":"https://api.github.com/users/cedel1/events{/privacy}","received_events_url":"https://api.github.com/users/cedel1/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-12-14T17:12:50Z","updated_at":"2018-12-17T20:31:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b38fd45f95b8076941c45cd90447b1bf31090ba4","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/druids/django-GDPR/pulls/6/commits","review_comments_url":"https://api.github.com/repos/druids/django-GDPR/pulls/6/comments","review_comment_url":"https://api.github.com/repos/druids/django-GDPR/pulls/comments{/number}","comments_url":"https://api.github.com/repos/druids/django-GDPR/issues/6/comments","statuses_url":"https://api.github.com/repos/druids/django-GDPR/statuses/605fdada768f6b72a86c4a0735457937668a0e0d","head":{"label":"cedel1:LegalReason_filters","ref":"LegalReason_filters","sha":"605fdada768f6b72a86c4a0735457937668a0e0d","user":{"login":"cedel1","id":841951,"node_id":"MDQ6VXNlcjg0MTk1MQ==","avatar_url":"https://avatars1.githubusercontent.com/u/841951?v=4","gravatar_id":"","url":"https://api.github.com/users/cedel1","html_url":"https://github.com/cedel1","followers_url":"https://api.github.com/users/cedel1/followers","following_url":"https://api.github.com/users/cedel1/following{/other_user}","gists_url":"https://api.github.com/users/cedel1/gists{/gist_id}","starred_url":"https://api.github.com/users/cedel1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cedel1/subscriptions","organizations_url":"https://api.github.com/users/cedel1/orgs","repos_url":"https://api.github.com/users/cedel1/repos","events_url":"https://api.github.com/users/cedel1/events{/privacy}","received_events_url":"https://api.github.com/users/cedel1/received_events","type":"User","site_admin":false},"repo":{"id":161787888,"node_id":"MDEwOlJlcG9zaXRvcnkxNjE3ODc4ODg=","name":"django-GDPR","full_name":"cedel1/django-GDPR","private":false,"owner":{"login":"cedel1","id":841951,"node_id":"MDQ6VXNlcjg0MTk1MQ==","avatar_url":"https://avatars1.githubusercontent.com/u/841951?v=4","gravatar_id":"","url":"https://api.github.com/users/cedel1","html_url":"https://github.com/cedel1","followers_url":"https://api.github.com/users/cedel1/followers","following_url":"https://api.github.com/users/cedel1/following{/other_user}","gists_url":"https://api.github.com/users/cedel1/gists{/gist_id}","starred_url":"https://api.github.com/users/cedel1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cedel1/subscriptions","organizations_url":"https://api.github.com/users/cedel1/orgs","repos_url":"https://api.github.com/users/cedel1/repos","events_url":"https://api.github.com/users/cedel1/events{/privacy}","received_events_url":"https://api.github.com/users/cedel1/received_events","type":"User","site_admin":false},"html_url":"https://github.com/cedel1/django-GDPR","description":null,"fork":true,"url":"https://api.github.com/repos/cedel1/django-GDPR","forks_url":"https://api.github.com/repos/cedel1/django-GDPR/forks","keys_url":"https://api.github.com/repos/cedel1/django-GDPR/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cedel1/django-GDPR/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cedel1/django-GDPR/teams","hooks_url":"https://api.github.com/repos/cedel1/django-GDPR/hooks","issue_events_url":"https://api.github.com/repos/cedel1/django-GDPR/issues/events{/number}","events_url":"https://api.github.com/repos/cedel1/django-GDPR/events","assignees_url":"https://api.github.com/repos/cedel1/django-GDPR/assignees{/user}","branches_url":"https://api.github.com/repos/cedel1/django-GDPR/branches{/branch}","tags_url":"https://api.github.com/repos/cedel1/django-GDPR/tags","blobs_url":"https://api.github.com/repos/cedel1/django-GDPR/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cedel1/django-GDPR/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cedel1/django-GDPR/git/refs{/sha}","trees_url":"https://api.github.com/repos/cedel1/django-GDPR/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cedel1/django-GDPR/statuses/{sha}","languages_url":"https://api.github.com/repos/cedel1/django-GDPR/languages","stargazers_url":"https://api.github.com/repos/cedel1/django-GDPR/stargazers","contributors_url":"https://api.github.com/repos/cedel1/django-GDPR/contributors","subscribers_url":"https://api.github.com/repos/cedel1/django-GDPR/subscribers","subscription_url":"https://api.github.com/repos/cedel1/django-GDPR/subscription","commits_url":"https://api.github.com/repos/cedel1/django-GDPR/commits{/sha}","git_commits_url":"https://api.github.com/repos/cedel1/django-GDPR/git/commits{/sha}","comments_url":"https://api.github.com/repos/cedel1/django-GDPR/comments{/number}","issue_comment_url":"https://api.github.com/repos/cedel1/django-GDPR/issues/comments{/number}","contents_url":"https://api.github.com/repos/cedel1/django-GDPR/contents/{+path}","compare_url":"https://api.github.com/repos/cedel1/django-GDPR/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cedel1/django-GDPR/merges","archive_url":"https://api.github.com/repos/cedel1/django-GDPR/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cedel1/django-GDPR/downloads","issues_url":"https://api.github.com/repos/cedel1/django-GDPR/issues{/number}","pulls_url":"https://api.github.com/repos/cedel1/django-GDPR/pulls{/number}","milestones_url":"https://api.github.com/repos/cedel1/django-GDPR/milestones{/number}","notifications_url":"https://api.github.com/repos/cedel1/django-GDPR/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cedel1/django-GDPR/labels{/name}","releases_url":"https://api.github.com/repos/cedel1/django-GDPR/releases{/id}","deployments_url":"https://api.github.com/repos/cedel1/django-GDPR/deployments","created_at":"2018-12-14T13:25:25Z","updated_at":"2018-12-14T13:25:27Z","pushed_at":"2018-12-14T16:53:45Z","git_url":"git://github.com/cedel1/django-GDPR.git","ssh_url":"git@github.com:cedel1/django-GDPR.git","clone_url":"https://github.com/cedel1/django-GDPR.git","svn_url":"https://github.com/cedel1/django-GDPR","homepage":null,"size":23,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"druids:master","ref":"master","sha":"2ab2c756621c4f0b4706c2f0525fb9d13d4bd764","user":{"login":"druids","id":16963627,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2OTYzNjI3","avatar_url":"https://avatars2.githubusercontent.com/u/16963627?v=4","gravatar_id":"","url":"https://api.github.com/users/druids","html_url":"https://github.com/druids","followers_url":"https://api.github.com/users/druids/followers","following_url":"https://api.github.com/users/druids/following{/other_user}","gists_url":"https://api.github.com/users/druids/gists{/gist_id}","starred_url":"https://api.github.com/users/druids/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/druids/subscriptions","organizations_url":"https://api.github.com/users/druids/orgs","repos_url":"https://api.github.com/users/druids/repos","events_url":"https://api.github.com/users/druids/events{/privacy}","received_events_url":"https://api.github.com/users/druids/received_events","type":"Organization","site_admin":false},"repo":{"id":129723677,"node_id":"MDEwOlJlcG9zaXRvcnkxMjk3MjM2Nzc=","name":"django-GDPR","full_name":"druids/django-GDPR","private":false,"owner":{"login":"druids","id":16963627,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2OTYzNjI3","avatar_url":"https://avatars2.githubusercontent.com/u/16963627?v=4","gravatar_id":"","url":"https://api.github.com/users/druids","html_url":"https://github.com/druids","followers_url":"https://api.github.com/users/druids/followers","following_url":"https://api.github.com/users/druids/following{/other_user}","gists_url":"https://api.github.com/users/druids/gists{/gist_id}","starred_url":"https://api.github.com/users/druids/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/druids/subscriptions","organizations_url":"https://api.github.com/users/druids/orgs","repos_url":"https://api.github.com/users/druids/repos","events_url":"https://api.github.com/users/druids/events{/privacy}","received_events_url":"https://api.github.com/users/druids/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/druids/django-GDPR","description":null,"fork":false,"url":"https://api.github.com/repos/druids/django-GDPR","forks_url":"https://api.github.com/repos/druids/django-GDPR/forks","keys_url":"https://api.github.com/repos/druids/django-GDPR/keys{/key_id}","collaborators_url":"https://api.github.com/repos/druids/django-GDPR/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/druids/django-GDPR/teams","hooks_url":"https://api.github.com/repos/druids/django-GDPR/hooks","issue_events_url":"https://api.github.com/repos/druids/django-GDPR/issues/events{/number}","events_url":"https://api.github.com/repos/druids/django-GDPR/events","assignees_url":"https://api.github.com/repos/druids/django-GDPR/assignees{/user}","branches_url":"https://api.github.com/repos/druids/django-GDPR/branches{/branch}","tags_url":"https://api.github.com/repos/druids/django-GDPR/tags","blobs_url":"https://api.github.com/repos/druids/django-GDPR/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/druids/django-GDPR/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/druids/django-GDPR/git/refs{/sha}","trees_url":"https://api.github.com/repos/druids/django-GDPR/git/trees{/sha}","statuses_url":"https://api.github.com/repos/druids/django-GDPR/statuses/{sha}","languages_url":"https://api.github.com/repos/druids/django-GDPR/languages","stargazers_url":"https://api.github.com/repos/druids/django-GDPR/stargazers","contributors_url":"https://api.github.com/repos/druids/django-GDPR/contributors","subscribers_url":"https://api.github.com/repos/druids/django-GDPR/subscribers","subscription_url":"https://api.github.com/repos/druids/django-GDPR/subscription","commits_url":"https://api.github.com/repos/druids/django-GDPR/commits{/sha}","git_commits_url":"https://api.github.com/repos/druids/django-GDPR/git/commits{/sha}","comments_url":"https://api.github.com/repos/druids/django-GDPR/comments{/number}","issue_comment_url":"https://api.github.com/repos/druids/django-GDPR/issues/comments{/number}","contents_url":"https://api.github.com/repos/druids/django-GDPR/contents/{+path}","compare_url":"https://api.github.com/repos/druids/django-GDPR/compare/{base}...{head}","merges_url":"https://api.github.com/repos/druids/django-GDPR/merges","archive_url":"https://api.github.com/repos/druids/django-GDPR/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/druids/django-GDPR/downloads","issues_url":"https://api.github.com/repos/druids/django-GDPR/issues{/number}","pulls_url":"https://api.github.com/repos/druids/django-GDPR/pulls{/number}","milestones_url":"https://api.github.com/repos/druids/django-GDPR/milestones{/number}","notifications_url":"https://api.github.com/repos/druids/django-GDPR/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/druids/django-GDPR/labels{/name}","releases_url":"https://api.github.com/repos/druids/django-GDPR/releases{/id}","deployments_url":"https://api.github.com/repos/druids/django-GDPR/deployments","created_at":"2018-04-16T10:09:44Z","updated_at":"2018-12-11T14:19:21Z","pushed_at":"2018-12-14T17:12:51Z","git_url":"git://github.com/druids/django-GDPR.git","ssh_url":"git@github.com:druids/django-GDPR.git","clone_url":"https://github.com/druids/django-GDPR.git","svn_url":"https://github.com/druids/django-GDPR","homepage":null,"size":20,"stargazers_count":5,"watchers_count":5,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"archived":false,"open_issues_count":2,"license":null,"forks":5,"open_issues":2,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/druids/django-GDPR/pulls/6"},"html":{"href":"https://github.com/druids/django-GDPR/pull/6"},"issue":{"href":"https://api.github.com/repos/druids/django-GDPR/issues/6"},"comments":{"href":"https://api.github.com/repos/druids/django-GDPR/issues/6/comments"},"review_comments":{"href":"https://api.github.com/repos/druids/django-GDPR/pulls/6/comments"},"review_comment":{"href":"https://api.github.com/repos/druids/django-GDPR/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/druids/django-GDPR/pulls/6/commits"},"statuses":{"href":"https://api.github.com/repos/druids/django-GDPR/statuses/605fdada768f6b72a86c4a0735457937668a0e0d"}},"author_association":"NONE"}}
{"actor":{"display_login":"rubickcz"}}