{"action":"created","comment":{"url":"https://api.github.com/repos/cfpb/cfgov-refresh/pulls/comments/84078008","pull_request_review_id":4873533,"id":84078008,"diff_hunk":"@@ -0,0 +1,82 @@\n+# Wagtail and Django data migrations","path":"docs/wagtail-migrations.md","position":1,"original_position":1,"commit_id":"5f7c5da44c3e6b2394a095faac6850478a9c7ef5","original_commit_id":"5f7c5da44c3e6b2394a095faac6850478a9c7ef5","user":{"login":"chosak","id":654645,"avatar_url":"https://avatars.githubusercontent.com/u/654645?v=3","gravatar_id":"","url":"https://api.github.com/users/chosak","html_url":"https://github.com/chosak","followers_url":"https://api.github.com/users/chosak/followers","following_url":"https://api.github.com/users/chosak/following{/other_user}","gists_url":"https://api.github.com/users/chosak/gists{/gist_id}","starred_url":"https://api.github.com/users/chosak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chosak/subscriptions","organizations_url":"https://api.github.com/users/chosak/orgs","repos_url":"https://api.github.com/users/chosak/repos","events_url":"https://api.github.com/users/chosak/events{/privacy}","received_events_url":"https://api.github.com/users/chosak/received_events","type":"User","site_admin":false},"body":"👍  for writing docs for this! When this is live we should drop a link to our approach in [the Wagtail issue](https://github.com/torchbox/wagtail/issues/1101) you linked to.","created_at":"2016-10-19T14:08:02Z","updated_at":"2016-10-19T14:08:46Z","html_url":"https://github.com/cfpb/cfgov-refresh/pull/2450#discussion_r84078008","pull_request_url":"https://api.github.com/repos/cfpb/cfgov-refresh/pulls/2450","_links":{"self":{"href":"https://api.github.com/repos/cfpb/cfgov-refresh/pulls/comments/84078008"},"html":{"href":"https://github.com/cfpb/cfgov-refresh/pull/2450#discussion_r84078008"},"pull_request":{"href":"https://api.github.com/repos/cfpb/cfgov-refresh/pulls/2450"}}},"pull_request":{"url":"https://api.github.com/repos/cfpb/cfgov-refresh/pulls/2450","id":88473629,"html_url":"https://github.com/cfpb/cfgov-refresh/pull/2450","diff_url":"https://github.com/cfpb/cfgov-refresh/pull/2450.diff","patch_url":"https://github.com/cfpb/cfgov-refresh/pull/2450.patch","issue_url":"https://api.github.com/repos/cfpb/cfgov-refresh/issues/2450","number":2450,"state":"open","locked":false,"title":"WIP: Eliminate duplicate category in ItemIntroduction organism","user":{"login":"willbarton","id":10562538,"avatar_url":"https://avatars.githubusercontent.com/u/10562538?v=3","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":"On pages that use the item introduction organism, content managers had to enter the category in both the item introduction and the configuration panel. The category in the item introduction was used to determine whether or not the category should be displayed on the page.\r\n\r\nThis PR replaces the category in the item introduction organism with a boolean field (show_category) that, when checked, will show the category selected in the page's configuration panel. This \"show category\" field is checked by default.\r\n\r\nBecause this PR requires both a schema and data migration to change existing pages, it also includes some utility functions adapted from [0011_hero_refactor_data.py](https://github.com/cfpb/cfgov-refresh/blob/master/cfgov/v1/migrations/0011_hero_refactor_data.py) that will hopefully make StreamField data migrations more straight-forward in the future.\r\n\r\nThis PR is labeled \"hold\" and \"work in progress\" at the moment until I can add some documentation around Wagtail migrations based on the previous work @chosak and @kurtrwall have done, the discussion in GHE#323, and the way I've modified it here. I will also update the changelog at that point.\r\n\r\n## Changes\r\n\r\n- Refactored `get_page_stream_data` and `set_page_stream_data` to handle either page objects or revision objects, renamed them `get_stream_data` and `set_stream_data`, and moved them to `v1.util.migrations`.\r\n\r\n## Additions\r\n\r\n- Added the `show_category` field on the ItemIntroduction organism\r\n- Added `migrate_stream_field` and `migrate_page_types_and_fields` utility functions\r\n \r\n## Removals\r\n\r\n- Removed the `category` field on the ItemIntroduction organism\r\n\r\n## Testing\r\n\r\n-   Add or edit a Learn page or Document detail page (children of `AbstractFilterPage`), add a category under \"Configuration\", toggle the new \"Show category\" checkbox, preview the page and the category should show up when \"Show category\" is checked or not depending on the value of the checkbox.\r\n- Run `tox` to run the tests for the migration and migration utility functions.\r\n\r\n## Review\r\n\r\n- @chosak and @kurtrwall for the migrations\r\n- @sarahsimpson09 for the item introduction change\r\n- @cfpb/cfgov-frontends for the template changes\r\n- @cfpb/cfgov-backends \r\n\r\n## Screenshots\r\n\r\n![3296ce9a-81b4-11e6-9673-1e53e9da4894](https://cloud.githubusercontent.com/assets/10562538/19198285/5a78d8e4-8c8c-11e6-85f8-a0834863b1d8.png)\r\n\r\n## Todos\r\n\r\n- [ ] Add documentation for Wagtail and migrations\r\n- [ ] Update CHANGELOG\r\n\r\n## Checklist\r\n\r\n* [X] Changes are limited to a single goal (no scope creep)\r\n* [X] Code can be automatically merged (no conflicts)\r\n* [X] Code follows the standards laid out in the [front end playbook](https://github.com/cfpb/front-end)\r\n* [X] Passes all existing automated tests\r\n* [X] New functions include new tests\r\n* [X] New functions are documented (with a description, list of inputs, and expected output)\r\n* [ ] Placeholder code is flagged\r\n* [ ] Visually tested in supported browsers and devices\r\n* [ ] Project documentation has been updated (including the \"Unreleased\" section of the CHANGELOG)\r\n","created_at":"2016-10-07T17:02:21Z","updated_at":"2016-10-19T14:08:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"be3836cef2d5fe7a7dad1ffb0683397047649545","assignee":{"login":"willbarton","id":10562538,"avatar_url":"https://avatars.githubusercontent.com/u/10562538?v=3","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},"assignees":[{"login":"willbarton","id":10562538,"avatar_url":"https://avatars.githubusercontent.com/u/10562538?v=3","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}],"milestone":null,"commits_url":"https://api.github.com/repos/cfpb/cfgov-refresh/pulls/2450/commits","review_comments_url":"https://api.github.com/repos/cfpb/cfgov-refresh/pulls/2450/comments","review_comment_url":"https://api.github.com/repos/cfpb/cfgov-refresh/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cfpb/cfgov-refresh/issues/2450/comments","statuses_url":"https://api.github.com/repos/cfpb/cfgov-refresh/statuses/5f7c5da44c3e6b2394a095faac6850478a9c7ef5","head":{"label":"cfpb:hide-dup-category","ref":"hide-dup-category","sha":"5f7c5da44c3e6b2394a095faac6850478a9c7ef5","user":{"login":"cfpb","id":1071563,"avatar_url":"https://avatars.githubusercontent.com/u/1071563?v=3","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":18852566,"name":"cfgov-refresh","full_name":"cfpb/cfgov-refresh","owner":{"login":"cfpb","id":1071563,"avatar_url":"https://avatars.githubusercontent.com/u/1071563?v=3","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},"private":false,"html_url":"https://github.com/cfpb/cfgov-refresh","description":"Django project that powers the redesigned consumerfinance.gov website.","fork":false,"url":"https://api.github.com/repos/cfpb/cfgov-refresh","forks_url":"https://api.github.com/repos/cfpb/cfgov-refresh/forks","keys_url":"https://api.github.com/repos/cfpb/cfgov-refresh/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cfpb/cfgov-refresh/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cfpb/cfgov-refresh/teams","hooks_url":"https://api.github.com/repos/cfpb/cfgov-refresh/hooks","issue_events_url":"https://api.github.com/repos/cfpb/cfgov-refresh/issues/events{/number}","events_url":"https://api.github.com/repos/cfpb/cfgov-refresh/events","assignees_url":"https://api.github.com/repos/cfpb/cfgov-refresh/assignees{/user}","branches_url":"https://api.github.com/repos/cfpb/cfgov-refresh/branches{/branch}","tags_url":"https://api.github.com/repos/cfpb/cfgov-refresh/tags","blobs_url":"https://api.github.com/repos/cfpb/cfgov-refresh/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cfpb/cfgov-refresh/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cfpb/cfgov-refresh/git/refs{/sha}","trees_url":"https://api.github.com/repos/cfpb/cfgov-refresh/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cfpb/cfgov-refresh/statuses/{sha}","languages_url":"https://api.github.com/repos/cfpb/cfgov-refresh/languages","stargazers_url":"https://api.github.com/repos/cfpb/cfgov-refresh/stargazers","contributors_url":"https://api.github.com/repos/cfpb/cfgov-refresh/contributors","subscribers_url":"https://api.github.com/repos/cfpb/cfgov-refresh/subscribers","subscription_url":"https://api.github.com/repos/cfpb/cfgov-refresh/subscription","commits_url":"https://api.github.com/repos/cfpb/cfgov-refresh/commits{/sha}","git_commits_url":"https://api.github.com/repos/cfpb/cfgov-refresh/git/commits{/sha}","comments_url":"https://api.github.com/repos/cfpb/cfgov-refresh/comments{/number}","issue_comment_url":"https://api.github.com/repos/cfpb/cfgov-refresh/issues/comments{/number}","contents_url":"https://api.github.com/repos/cfpb/cfgov-refresh/contents/{+path}","compare_url":"https://api.github.com/repos/cfpb/cfgov-refresh/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cfpb/cfgov-refresh/merges","archive_url":"https://api.github.com/repos/cfpb/cfgov-refresh/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cfpb/cfgov-refresh/downloads","issues_url":"https://api.github.com/repos/cfpb/cfgov-refresh/issues{/number}","pulls_url":"https://api.github.com/repos/cfpb/cfgov-refresh/pulls{/number}","milestones_url":"https://api.github.com/repos/cfpb/cfgov-refresh/milestones{/number}","notifications_url":"https://api.github.com/repos/cfpb/cfgov-refresh/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cfpb/cfgov-refresh/labels{/name}","releases_url":"https://api.github.com/repos/cfpb/cfgov-refresh/releases{/id}","deployments_url":"https://api.github.com/repos/cfpb/cfgov-refresh/deployments","created_at":"2014-04-16T19:22:03Z","updated_at":"2016-09-25T15:08:32Z","pushed_at":"2016-10-19T13:49:59Z","git_url":"git://github.com/cfpb/cfgov-refresh.git","ssh_url":"git@github.com:cfpb/cfgov-refresh.git","clone_url":"https://github.com/cfpb/cfgov-refresh.git","svn_url":"https://github.com/cfpb/cfgov-refresh","homepage":"http://www.consumerfinance.gov/","size":131142,"stargazers_count":72,"watchers_count":72,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":41,"mirror_url":null,"open_issues_count":102,"forks":41,"open_issues":102,"watchers":72,"default_branch":"master"}},"base":{"label":"cfpb:master","ref":"master","sha":"0cb22d51d2b042c4e91556d084e716f912068683","user":{"login":"cfpb","id":1071563,"avatar_url":"https://avatars.githubusercontent.com/u/1071563?v=3","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":18852566,"name":"cfgov-refresh","full_name":"cfpb/cfgov-refresh","owner":{"login":"cfpb","id":1071563,"avatar_url":"https://avatars.githubusercontent.com/u/1071563?v=3","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},"private":false,"html_url":"https://github.com/cfpb/cfgov-refresh","description":"Django project that powers the redesigned consumerfinance.gov website.","fork":false,"url":"https://api.github.com/repos/cfpb/cfgov-refresh","forks_url":"https://api.github.com/repos/cfpb/cfgov-refresh/forks","keys_url":"https://api.github.com/repos/cfpb/cfgov-refresh/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cfpb/cfgov-refresh/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cfpb/cfgov-refresh/teams","hooks_url":"https://api.github.com/repos/cfpb/cfgov-refresh/hooks","issue_events_url":"https://api.github.com/repos/cfpb/cfgov-refresh/issues/events{/number}","events_url":"https://api.github.com/repos/cfpb/cfgov-refresh/events","assignees_url":"https://api.github.com/repos/cfpb/cfgov-refresh/assignees{/user}","branches_url":"https://api.github.com/repos/cfpb/cfgov-refresh/branches{/branch}","tags_url":"https://api.github.com/repos/cfpb/cfgov-refresh/tags","blobs_url":"https://api.github.com/repos/cfpb/cfgov-refresh/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cfpb/cfgov-refresh/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cfpb/cfgov-refresh/git/refs{/sha}","trees_url":"https://api.github.com/repos/cfpb/cfgov-refresh/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cfpb/cfgov-refresh/statuses/{sha}","languages_url":"https://api.github.com/repos/cfpb/cfgov-refresh/languages","stargazers_url":"https://api.github.com/repos/cfpb/cfgov-refresh/stargazers","contributors_url":"https://api.github.com/repos/cfpb/cfgov-refresh/contributors","subscribers_url":"https://api.github.com/repos/cfpb/cfgov-refresh/subscribers","subscription_url":"https://api.github.com/repos/cfpb/cfgov-refresh/subscription","commits_url":"https://api.github.com/repos/cfpb/cfgov-refresh/commits{/sha}","git_commits_url":"https://api.github.com/repos/cfpb/cfgov-refresh/git/commits{/sha}","comments_url":"https://api.github.com/repos/cfpb/cfgov-refresh/comments{/number}","issue_comment_url":"https://api.github.com/repos/cfpb/cfgov-refresh/issues/comments{/number}","contents_url":"https://api.github.com/repos/cfpb/cfgov-refresh/contents/{+path}","compare_url":"https://api.github.com/repos/cfpb/cfgov-refresh/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cfpb/cfgov-refresh/merges","archive_url":"https://api.github.com/repos/cfpb/cfgov-refresh/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cfpb/cfgov-refresh/downloads","issues_url":"https://api.github.com/repos/cfpb/cfgov-refresh/issues{/number}","pulls_url":"https://api.github.com/repos/cfpb/cfgov-refresh/pulls{/number}","milestones_url":"https://api.github.com/repos/cfpb/cfgov-refresh/milestones{/number}","notifications_url":"https://api.github.com/repos/cfpb/cfgov-refresh/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cfpb/cfgov-refresh/labels{/name}","releases_url":"https://api.github.com/repos/cfpb/cfgov-refresh/releases{/id}","deployments_url":"https://api.github.com/repos/cfpb/cfgov-refresh/deployments","created_at":"2014-04-16T19:22:03Z","updated_at":"2016-09-25T15:08:32Z","pushed_at":"2016-10-19T13:49:59Z","git_url":"git://github.com/cfpb/cfgov-refresh.git","ssh_url":"git@github.com:cfpb/cfgov-refresh.git","clone_url":"https://github.com/cfpb/cfgov-refresh.git","svn_url":"https://github.com/cfpb/cfgov-refresh","homepage":"http://www.consumerfinance.gov/","size":131142,"stargazers_count":72,"watchers_count":72,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":41,"mirror_url":null,"open_issues_count":102,"forks":41,"open_issues":102,"watchers":72,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cfpb/cfgov-refresh/pulls/2450"},"html":{"href":"https://github.com/cfpb/cfgov-refresh/pull/2450"},"issue":{"href":"https://api.github.com/repos/cfpb/cfgov-refresh/issues/2450"},"comments":{"href":"https://api.github.com/repos/cfpb/cfgov-refresh/issues/2450/comments"},"review_comments":{"href":"https://api.github.com/repos/cfpb/cfgov-refresh/pulls/2450/comments"},"review_comment":{"href":"https://api.github.com/repos/cfpb/cfgov-refresh/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cfpb/cfgov-refresh/pulls/2450/commits"},"statuses":{"href":"https://api.github.com/repos/cfpb/cfgov-refresh/statuses/5f7c5da44c3e6b2394a095faac6850478a9c7ef5"}}}}
{"actor":{"display_login":"chosak"}}