{"action":"created","comment":{"url":"https://api.github.com/repos/cfpb/django-flags/pulls/comments/223794845","pull_request_review_id":163006236,"id":223794845,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyMzc5NDg0NQ==","diff_hunk":"@@ -1,50 +1,63 @@\n # Jinja2 templates\n \n-Django-Flags provides template functions that can be added to a Jinja2 environment and subsequently used in templates.\n+Django-Flags provides an extension for adding the template tags to your Jinja2\n+backend configuration to enable the tags to be used in Jinja2 templates.\n \n ```python\n-from flags.template_functions import (\n-    flag_enabled,\n-    flag_disabled\n-)\n-from jinja2 import Environment\n-\n-...\n-\n-env = Environment(…)\n-env.globals.update(\n-    flag_enabled=flag_enabled,\n-    flag_disabled=flag_disabled\n-)\n+TEMPLATES = [\n+    {\n+        'BACKEND': 'django.template.backends.django.DjangoTemplates',\n+        ...\n+    },\n+    {\n+        'BACKEND': 'django.template.backends.jinja2.Jinja2',\n+        ...\n+        'OPTIONS': {\n+            'extensions': [\n+                ...\n+                'flags.jinja2tags.flags',  # add this line to your existing settings\n+                ...\n+            ],\n+        }\n+    },\n+]\n ```\n \n+\n ## Checking state\n \n ### `flag_enabled`\n \n-Returns `True` if a flag is enabled by for the given request, otherwise returns `False`.\n+Returns `True` if a flag is enabled for the current request, otherwise returns `False`.\n \n ```jinja\n-{% if flag_enabled('MY_FLAG', request) %}\n+{% if flag_enabled('MY_FLAG') %}\n   <div class=\"m-global-banner\">\n     I’m the result of a feature flag.   \n   </div>\n {% endif %}\n ```\n \n-`request` is optional.\n-\n ### `flag_disabled`\n \n-Returns `True` if a flag is disabled by passing the current request to its conditions, otherwise returns `False`.\n-Returns `True` if a flag is disabled by for the given request, otherwise returns `False`.\n+Returns `True` if a flag is disabled for the current request to its conditions, otherwise returns `False`.\n \n ```jinja\n-{% if flag_disabled('MY_FLAG', request) %}\n+{% if flag_disabled('MY_FLAG') %}\n   <div class=\"m-global-banner\">\n     I’m the result of a feature flag that is not enabled.\n   </div>\n {% endif %}\n ```\n \n-`request` is optional.\n+\n+## Passing additional arguments\n+\n+For some flag conditions, you may want to pass in additional keyword arguments.\n+For example, you could pass in the `page` object:","path":"docs/api/jinja2.md","position":79,"original_position":79,"commit_id":"20a978327a6b282417806ff2af345e423329a369","original_commit_id":"20a978327a6b282417806ff2af345e423329a369","user":{"login":"willbarton","id":10562538,"node_id":"MDQ6VXNlcjEwNTYyNTM4","avatar_url":"https://avatars0.githubusercontent.com/u/10562538?v=4","gravatar_id":"","url":"https://api.github.com/users/willbarton","html_url":"https://github.com/willbarton","followers_url":"https://api.github.com/users/willbarton/followers","following_url":"https://api.github.com/users/willbarton/following{/other_user}","gists_url":"https://api.github.com/users/willbarton/gists{/gist_id}","starred_url":"https://api.github.com/users/willbarton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/willbarton/subscriptions","organizations_url":"https://api.github.com/users/willbarton/orgs","repos_url":"https://api.github.com/users/willbarton/repos","events_url":"https://api.github.com/users/willbarton/events{/privacy}","received_events_url":"https://api.github.com/users/willbarton/received_events","type":"User","site_admin":false},"body":"Same as with the django template documentation, \"~~the~~a `page` object\".","created_at":"2018-10-09T17:32:30Z","updated_at":"2018-10-09T17:36:00Z","html_url":"https://github.com/cfpb/django-flags/pull/14#discussion_r223794845","pull_request_url":"https://api.github.com/repos/cfpb/django-flags/pulls/14","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/cfpb/django-flags/pulls/comments/223794845"},"html":{"href":"https://github.com/cfpb/django-flags/pull/14#discussion_r223794845"},"pull_request":{"href":"https://api.github.com/repos/cfpb/django-flags/pulls/14"}}},"pull_request":{"url":"https://api.github.com/repos/cfpb/django-flags/pulls/14","id":220834897,"node_id":"MDExOlB1bGxSZXF1ZXN0MjIwODM0ODk3","html_url":"https://github.com/cfpb/django-flags/pull/14","diff_url":"https://github.com/cfpb/django-flags/pull/14.diff","patch_url":"https://github.com/cfpb/django-flags/pull/14.patch","issue_url":"https://api.github.com/repos/cfpb/django-flags/issues/14","number":14,"state":"open","locked":false,"title":"Allow passing kwargs to flag_enabled and flag_disabled template tags","user":{"login":"Scotchester","id":1044670,"node_id":"MDQ6VXNlcjEwNDQ2NzA=","avatar_url":"https://avatars3.githubusercontent.com/u/1044670?v=4","gravatar_id":"","url":"https://api.github.com/users/Scotchester","html_url":"https://github.com/Scotchester","followers_url":"https://api.github.com/users/Scotchester/followers","following_url":"https://api.github.com/users/Scotchester/following{/other_user}","gists_url":"https://api.github.com/users/Scotchester/gists{/gist_id}","starred_url":"https://api.github.com/users/Scotchester/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Scotchester/subscriptions","organizations_url":"https://api.github.com/users/Scotchester/orgs","repos_url":"https://api.github.com/users/Scotchester/repos","events_url":"https://api.github.com/users/Scotchester/events{/privacy}","received_events_url":"https://api.github.com/users/Scotchester/received_events","type":"User","site_admin":false},"body":"This will be used in a forthcoming cfgov-refresh PR to pass the Wagtail `page` object to a condition, so that it can test whether or not a `page` property matches something else.\r\n\r\nIt also adds an extension for Jinja2 tags, so that apps don't have to develop their own.\r\n\r\nMight need some more tests?","created_at":"2018-10-05T21:59:34Z","updated_at":"2018-10-09T17:36:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bdcde4215cab997c703a42210d21bcbb5f8d4756","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/cfpb/django-flags/pulls/14/commits","review_comments_url":"https://api.github.com/repos/cfpb/django-flags/pulls/14/comments","review_comment_url":"https://api.github.com/repos/cfpb/django-flags/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cfpb/django-flags/issues/14/comments","statuses_url":"https://api.github.com/repos/cfpb/django-flags/statuses/20a978327a6b282417806ff2af345e423329a369","head":{"label":"cfpb:template-tag-kwargs","ref":"template-tag-kwargs","sha":"20a978327a6b282417806ff2af345e423329a369","user":{"login":"cfpb","id":1071563,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEwNzE1NjM=","avatar_url":"https://avatars2.githubusercontent.com/u/1071563?v=4","gravatar_id":"","url":"https://api.github.com/users/cfpb","html_url":"https://github.com/cfpb","followers_url":"https://api.github.com/users/cfpb/followers","following_url":"https://api.github.com/users/cfpb/following{/other_user}","gists_url":"https://api.github.com/users/cfpb/gists{/gist_id}","starred_url":"https://api.github.com/users/cfpb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cfpb/subscriptions","organizations_url":"https://api.github.com/users/cfpb/orgs","repos_url":"https://api.github.com/users/cfpb/repos","events_url":"https://api.github.com/users/cfpb/events{/privacy}","received_events_url":"https://api.github.com/users/cfpb/received_events","type":"Organization","site_admin":false},"repo":{"id":137590135,"node_id":"MDEwOlJlcG9zaXRvcnkxMzc1OTAxMzU=","name":"django-flags","full_name":"cfpb/django-flags","private":false,"owner":{"login":"cfpb","id":1071563,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEwNzE1NjM=","avatar_url":"https://avatars2.githubusercontent.com/u/1071563?v=4","gravatar_id":"","url":"https://api.github.com/users/cfpb","html_url":"https://github.com/cfpb","followers_url":"https://api.github.com/users/cfpb/followers","following_url":"https://api.github.com/users/cfpb/following{/other_user}","gists_url":"https://api.github.com/users/cfpb/gists{/gist_id}","starred_url":"https://api.github.com/users/cfpb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cfpb/subscriptions","organizations_url":"https://api.github.com/users/cfpb/orgs","repos_url":"https://api.github.com/users/cfpb/repos","events_url":"https://api.github.com/users/cfpb/events{/privacy}","received_events_url":"https://api.github.com/users/cfpb/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/cfpb/django-flags","description":"Feature flags for Django projects","fork":false,"url":"https://api.github.com/repos/cfpb/django-flags","forks_url":"https://api.github.com/repos/cfpb/django-flags/forks","keys_url":"https://api.github.com/repos/cfpb/django-flags/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cfpb/django-flags/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cfpb/django-flags/teams","hooks_url":"https://api.github.com/repos/cfpb/django-flags/hooks","issue_events_url":"https://api.github.com/repos/cfpb/django-flags/issues/events{/number}","events_url":"https://api.github.com/repos/cfpb/django-flags/events","assignees_url":"https://api.github.com/repos/cfpb/django-flags/assignees{/user}","branches_url":"https://api.github.com/repos/cfpb/django-flags/branches{/branch}","tags_url":"https://api.github.com/repos/cfpb/django-flags/tags","blobs_url":"https://api.github.com/repos/cfpb/django-flags/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cfpb/django-flags/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cfpb/django-flags/git/refs{/sha}","trees_url":"https://api.github.com/repos/cfpb/django-flags/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cfpb/django-flags/statuses/{sha}","languages_url":"https://api.github.com/repos/cfpb/django-flags/languages","stargazers_url":"https://api.github.com/repos/cfpb/django-flags/stargazers","contributors_url":"https://api.github.com/repos/cfpb/django-flags/contributors","subscribers_url":"https://api.github.com/repos/cfpb/django-flags/subscribers","subscription_url":"https://api.github.com/repos/cfpb/django-flags/subscription","commits_url":"https://api.github.com/repos/cfpb/django-flags/commits{/sha}","git_commits_url":"https://api.github.com/repos/cfpb/django-flags/git/commits{/sha}","comments_url":"https://api.github.com/repos/cfpb/django-flags/comments{/number}","issue_comment_url":"https://api.github.com/repos/cfpb/django-flags/issues/comments{/number}","contents_url":"https://api.github.com/repos/cfpb/django-flags/contents/{+path}","compare_url":"https://api.github.com/repos/cfpb/django-flags/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cfpb/django-flags/merges","archive_url":"https://api.github.com/repos/cfpb/django-flags/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cfpb/django-flags/downloads","issues_url":"https://api.github.com/repos/cfpb/django-flags/issues{/number}","pulls_url":"https://api.github.com/repos/cfpb/django-flags/pulls{/number}","milestones_url":"https://api.github.com/repos/cfpb/django-flags/milestones{/number}","notifications_url":"https://api.github.com/repos/cfpb/django-flags/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cfpb/django-flags/labels{/name}","releases_url":"https://api.github.com/repos/cfpb/django-flags/releases{/id}","deployments_url":"https://api.github.com/repos/cfpb/django-flags/deployments","created_at":"2018-06-16T15:23:55Z","updated_at":"2018-09-27T13:35:10Z","pushed_at":"2018-10-09T17:16:50Z","git_url":"git://github.com/cfpb/django-flags.git","ssh_url":"git@github.com:cfpb/django-flags.git","clone_url":"https://github.com/cfpb/django-flags.git","svn_url":"https://github.com/cfpb/django-flags","homepage":null,"size":943,"stargazers_count":5,"watchers_count":5,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":3,"license":{"key":"other","name":"NOASSERTION","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":1,"open_issues":3,"watchers":5,"default_branch":"master"}},"base":{"label":"cfpb:master","ref":"master","sha":"a37b5aed37b4187b906443aff7aeef7405ff1ab7","user":{"login":"cfpb","id":1071563,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEwNzE1NjM=","avatar_url":"https://avatars2.githubusercontent.com/u/1071563?v=4","gravatar_id":"","url":"https://api.github.com/users/cfpb","html_url":"https://github.com/cfpb","followers_url":"https://api.github.com/users/cfpb/followers","following_url":"https://api.github.com/users/cfpb/following{/other_user}","gists_url":"https://api.github.com/users/cfpb/gists{/gist_id}","starred_url":"https://api.github.com/users/cfpb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cfpb/subscriptions","organizations_url":"https://api.github.com/users/cfpb/orgs","repos_url":"https://api.github.com/users/cfpb/repos","events_url":"https://api.github.com/users/cfpb/events{/privacy}","received_events_url":"https://api.github.com/users/cfpb/received_events","type":"Organization","site_admin":false},"repo":{"id":137590135,"node_id":"MDEwOlJlcG9zaXRvcnkxMzc1OTAxMzU=","name":"django-flags","full_name":"cfpb/django-flags","private":false,"owner":{"login":"cfpb","id":1071563,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEwNzE1NjM=","avatar_url":"https://avatars2.githubusercontent.com/u/1071563?v=4","gravatar_id":"","url":"https://api.github.com/users/cfpb","html_url":"https://github.com/cfpb","followers_url":"https://api.github.com/users/cfpb/followers","following_url":"https://api.github.com/users/cfpb/following{/other_user}","gists_url":"https://api.github.com/users/cfpb/gists{/gist_id}","starred_url":"https://api.github.com/users/cfpb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cfpb/subscriptions","organizations_url":"https://api.github.com/users/cfpb/orgs","repos_url":"https://api.github.com/users/cfpb/repos","events_url":"https://api.github.com/users/cfpb/events{/privacy}","received_events_url":"https://api.github.com/users/cfpb/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/cfpb/django-flags","description":"Feature flags for Django projects","fork":false,"url":"https://api.github.com/repos/cfpb/django-flags","forks_url":"https://api.github.com/repos/cfpb/django-flags/forks","keys_url":"https://api.github.com/repos/cfpb/django-flags/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cfpb/django-flags/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cfpb/django-flags/teams","hooks_url":"https://api.github.com/repos/cfpb/django-flags/hooks","issue_events_url":"https://api.github.com/repos/cfpb/django-flags/issues/events{/number}","events_url":"https://api.github.com/repos/cfpb/django-flags/events","assignees_url":"https://api.github.com/repos/cfpb/django-flags/assignees{/user}","branches_url":"https://api.github.com/repos/cfpb/django-flags/branches{/branch}","tags_url":"https://api.github.com/repos/cfpb/django-flags/tags","blobs_url":"https://api.github.com/repos/cfpb/django-flags/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cfpb/django-flags/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cfpb/django-flags/git/refs{/sha}","trees_url":"https://api.github.com/repos/cfpb/django-flags/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cfpb/django-flags/statuses/{sha}","languages_url":"https://api.github.com/repos/cfpb/django-flags/languages","stargazers_url":"https://api.github.com/repos/cfpb/django-flags/stargazers","contributors_url":"https://api.github.com/repos/cfpb/django-flags/contributors","subscribers_url":"https://api.github.com/repos/cfpb/django-flags/subscribers","subscription_url":"https://api.github.com/repos/cfpb/django-flags/subscription","commits_url":"https://api.github.com/repos/cfpb/django-flags/commits{/sha}","git_commits_url":"https://api.github.com/repos/cfpb/django-flags/git/commits{/sha}","comments_url":"https://api.github.com/repos/cfpb/django-flags/comments{/number}","issue_comment_url":"https://api.github.com/repos/cfpb/django-flags/issues/comments{/number}","contents_url":"https://api.github.com/repos/cfpb/django-flags/contents/{+path}","compare_url":"https://api.github.com/repos/cfpb/django-flags/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cfpb/django-flags/merges","archive_url":"https://api.github.com/repos/cfpb/django-flags/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cfpb/django-flags/downloads","issues_url":"https://api.github.com/repos/cfpb/django-flags/issues{/number}","pulls_url":"https://api.github.com/repos/cfpb/django-flags/pulls{/number}","milestones_url":"https://api.github.com/repos/cfpb/django-flags/milestones{/number}","notifications_url":"https://api.github.com/repos/cfpb/django-flags/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cfpb/django-flags/labels{/name}","releases_url":"https://api.github.com/repos/cfpb/django-flags/releases{/id}","deployments_url":"https://api.github.com/repos/cfpb/django-flags/deployments","created_at":"2018-06-16T15:23:55Z","updated_at":"2018-09-27T13:35:10Z","pushed_at":"2018-10-09T17:16:50Z","git_url":"git://github.com/cfpb/django-flags.git","ssh_url":"git@github.com:cfpb/django-flags.git","clone_url":"https://github.com/cfpb/django-flags.git","svn_url":"https://github.com/cfpb/django-flags","homepage":null,"size":943,"stargazers_count":5,"watchers_count":5,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":3,"license":{"key":"other","name":"NOASSERTION","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":1,"open_issues":3,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cfpb/django-flags/pulls/14"},"html":{"href":"https://github.com/cfpb/django-flags/pull/14"},"issue":{"href":"https://api.github.com/repos/cfpb/django-flags/issues/14"},"comments":{"href":"https://api.github.com/repos/cfpb/django-flags/issues/14/comments"},"review_comments":{"href":"https://api.github.com/repos/cfpb/django-flags/pulls/14/comments"},"review_comment":{"href":"https://api.github.com/repos/cfpb/django-flags/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cfpb/django-flags/pulls/14/commits"},"statuses":{"href":"https://api.github.com/repos/cfpb/django-flags/statuses/20a978327a6b282417806ff2af345e423329a369"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"willbarton"}}