{"action":"created","comment":{"url":"https://api.github.com/repos/hack4impact/women-veterans-rock/pulls/comments/44897091","id":44897091,"diff_hunk":"@@ -0,0 +1,61 @@\n+from flask import render_template, redirect, url_for\n+from flask.ext.login import login_required, current_user\n+from . import resources\n+from .. import db\n+from ..models import Resource, ZIPCode, Address, User\n+from .forms import ResourceForm\n+\n+\n+@resources.route('/', methods=['GET'])\n+def index():\n+    return render_template('resources/index.html')\n+\n+\n+@resources.route('/add', methods=['GET', 'POST'])\n+@login_required\n+def add():\n+    form = ResourceForm()\n+    if form.validate_on_submit():\n+        # based on form's zip code, load or create ZIPCode and add to db\n+        zip_code = ZIPCode.create_zip_code(form.postal_code.data)\n+        # based on form's address, zip's id, load or create Address, add to db\n+        street_num_route = str(form.street_number.data) + ' ' + form.route.data\n+        # should create helper method in models/location.py\n+        address = Address.query.filter_by(\n+            name=form.name.data,\n+            street_address=street_num_route,\n+            city=form.locality.data,\n+            state=form.administrative_area_level_1.data,\n+            zip_code_id=zip_code.id).first()\n+        if address is None:\n+            address = Address(name=form.name.data,\n+                              street_address=street_num_route,\n+                              city=form.locality.data,\n+                              state=form.administrative_area_level_1.data,\n+                              zip_code_id=zip_code.id)\n+            db.session.add(address)\n+            db.session.commit()\n+        # based on form and address id, create a new resource\n+        # should create helper method in models/resource.py\n+        resource = Resource(name=form.name.data,\n+                            description=form.description.data,\n+                            website=form.website.data,\n+                            address_id=address.id,\n+                            user_id=int(current_user.get_id()))\n+        db.session.add(resource)\n+        db.session.commit()\n+        print resource.id\n+        return redirect(url_for('resources.index'))\n+    return render_template('resources/add.html', form=form)\n+\n+\n+@resources.route('/resource/<int:resource_id>')\n+def show_resource(resource_id):\n+    # show the resource with the given id, the id is an integer\n+    resource = Resource.query.filter_by(id=resource_id).first()\n+    address = Address.query.filter_by(id=resource.address_id).first()\n+    user = User.query.filter_by(id=resource.user_id).first()","path":"app/resources/views.py","position":57,"original_position":57,"commit_id":"ed99ef6e6cdf6435d1e7385d4f02d42b1ff4fe58","original_commit_id":"ed99ef6e6cdf6435d1e7385d4f02d42b1ff4fe58","user":{"login":"aharelick","id":3924168,"avatar_url":"https://avatars.githubusercontent.com/u/3924168?v=3","gravatar_id":"","url":"https://api.github.com/users/aharelick","html_url":"https://github.com/aharelick","followers_url":"https://api.github.com/users/aharelick/followers","following_url":"https://api.github.com/users/aharelick/following{/other_user}","gists_url":"https://api.github.com/users/aharelick/gists{/gist_id}","starred_url":"https://api.github.com/users/aharelick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aharelick/subscriptions","organizations_url":"https://api.github.com/users/aharelick/orgs","repos_url":"https://api.github.com/users/aharelick/repos","events_url":"https://api.github.com/users/aharelick/events{/privacy}","received_events_url":"https://api.github.com/users/aharelick/received_events","type":"User","site_admin":false},"body":"`user = User.query.get(resource.user_id)`","created_at":"2015-11-16T08:19:23Z","updated_at":"2015-11-16T08:19:23Z","html_url":"https://github.com/hack4impact/women-veterans-rock/pull/20#discussion_r44897091","pull_request_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/pulls/20","_links":{"self":{"href":"https://api.github.com/repos/hack4impact/women-veterans-rock/pulls/comments/44897091"},"html":{"href":"https://github.com/hack4impact/women-veterans-rock/pull/20#discussion_r44897091"},"pull_request":{"href":"https://api.github.com/repos/hack4impact/women-veterans-rock/pulls/20"}}},"pull_request":{"url":"https://api.github.com/repos/hack4impact/women-veterans-rock/pulls/20","id":50665890,"html_url":"https://github.com/hack4impact/women-veterans-rock/pull/20","diff_url":"https://github.com/hack4impact/women-veterans-rock/pull/20.diff","patch_url":"https://github.com/hack4impact/women-veterans-rock/pull/20.patch","issue_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/issues/20","number":20,"state":"open","locked":false,"title":"Address autocomplete when adding resources","user":{"login":"yoninachmany","id":4250521,"avatar_url":"https://avatars.githubusercontent.com/u/4250521?v=3","gravatar_id":"","url":"https://api.github.com/users/yoninachmany","html_url":"https://github.com/yoninachmany","followers_url":"https://api.github.com/users/yoninachmany/followers","following_url":"https://api.github.com/users/yoninachmany/following{/other_user}","gists_url":"https://api.github.com/users/yoninachmany/gists{/gist_id}","starred_url":"https://api.github.com/users/yoninachmany/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yoninachmany/subscriptions","organizations_url":"https://api.github.com/users/yoninachmany/orgs","repos_url":"https://api.github.com/users/yoninachmany/repos","events_url":"https://api.github.com/users/yoninachmany/events{/privacy}","received_events_url":"https://api.github.com/users/yoninachmany/received_events","type":"User","site_admin":false},"body":"r @aharelick @anoshaminai \r\n\r\n- Added Google Maps Place Autocomplete JS to template with API key from my account\r\n- Had to change form field names to match the schema of Google Maps\r\n- Had to alter the queries in the view file to reflect different form fields\r\n- Improved /resources/resource/<int:id> page fields\r\n- Potential issue: document.onLoad disables fields, but that can be annoying for users if they submit invalid form the first time\r\n<img width=\"1280\" alt=\"screen shot 2015-11-13 at 9 24 10 am\" src=\"https://cloud.githubusercontent.com/assets/4250521/11149568/9dc3308e-89f1-11e5-858a-1183101aa510.png\">\r\n<img width=\"1258\" alt=\"screen shot 2015-11-13 at 9 36 02 am\" src=\"https://cloud.githubusercontent.com/assets/4250521/11152232/5dfb0acc-89ff-11e5-9635-1dc55a44ce05.png\">\r\n<img width=\"1258\" alt=\"screen shot 2015-11-13 at 9 36 12 am\" src=\"https://cloud.githubusercontent.com/assets/4250521/11152231/5df875f0-89ff-11e5-9453-890f940fee60.png\">\r\n<img width=\"1257\" alt=\"screen shot 2015-11-13 at 9 54 56 am\" src=\"https://cloud.githubusercontent.com/assets/4250521/11152233/5ee7a3c8-89ff-11e5-83ad-88ad1ec69dc1.png\">\r\n\r\n\r\n\r\n","created_at":"2015-11-13T17:09:49Z","updated_at":"2015-11-16T08:19:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c8b49ddd6f5fcba557d627f62c46a9135ba5db33","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/pulls/20/commits","review_comments_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/pulls/20/comments","review_comment_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/issues/20/comments","statuses_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/statuses/ed99ef6e6cdf6435d1e7385d4f02d42b1ff4fe58","head":{"label":"hack4impact:yoni-place-autocomplete","ref":"yoni-place-autocomplete","sha":"ed99ef6e6cdf6435d1e7385d4f02d42b1ff4fe58","user":{"login":"hack4impact","id":9021093,"avatar_url":"https://avatars.githubusercontent.com/u/9021093?v=3","gravatar_id":"","url":"https://api.github.com/users/hack4impact","html_url":"https://github.com/hack4impact","followers_url":"https://api.github.com/users/hack4impact/followers","following_url":"https://api.github.com/users/hack4impact/following{/other_user}","gists_url":"https://api.github.com/users/hack4impact/gists{/gist_id}","starred_url":"https://api.github.com/users/hack4impact/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hack4impact/subscriptions","organizations_url":"https://api.github.com/users/hack4impact/orgs","repos_url":"https://api.github.com/users/hack4impact/repos","events_url":"https://api.github.com/users/hack4impact/events{/privacy}","received_events_url":"https://api.github.com/users/hack4impact/received_events","type":"Organization","site_admin":false},"repo":{"id":43617101,"name":"women-veterans-rock","full_name":"hack4impact/women-veterans-rock","owner":{"login":"hack4impact","id":9021093,"avatar_url":"https://avatars.githubusercontent.com/u/9021093?v=3","gravatar_id":"","url":"https://api.github.com/users/hack4impact","html_url":"https://github.com/hack4impact","followers_url":"https://api.github.com/users/hack4impact/followers","following_url":"https://api.github.com/users/hack4impact/following{/other_user}","gists_url":"https://api.github.com/users/hack4impact/gists{/gist_id}","starred_url":"https://api.github.com/users/hack4impact/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hack4impact/subscriptions","organizations_url":"https://api.github.com/users/hack4impact/orgs","repos_url":"https://api.github.com/users/hack4impact/repos","events_url":"https://api.github.com/users/hack4impact/events{/privacy}","received_events_url":"https://api.github.com/users/hack4impact/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hack4impact/women-veterans-rock","description":"","fork":false,"url":"https://api.github.com/repos/hack4impact/women-veterans-rock","forks_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/forks","keys_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/teams","hooks_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/hooks","issue_events_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/issues/events{/number}","events_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/events","assignees_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/assignees{/user}","branches_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/branches{/branch}","tags_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/tags","blobs_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/git/refs{/sha}","trees_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/statuses/{sha}","languages_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/languages","stargazers_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/stargazers","contributors_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/contributors","subscribers_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/subscribers","subscription_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/subscription","commits_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/commits{/sha}","git_commits_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/git/commits{/sha}","comments_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/comments{/number}","issue_comment_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/issues/comments{/number}","contents_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/contents/{+path}","compare_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/merges","archive_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/downloads","issues_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/issues{/number}","pulls_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/pulls{/number}","milestones_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/milestones{/number}","notifications_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/labels{/name}","releases_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/releases{/id}","created_at":"2015-10-03T22:21:16Z","updated_at":"2015-11-13T18:13:53Z","pushed_at":"2015-11-16T06:40:02Z","git_url":"git://github.com/hack4impact/women-veterans-rock.git","ssh_url":"git@github.com:hack4impact/women-veterans-rock.git","clone_url":"https://github.com/hack4impact/women-veterans-rock.git","svn_url":"https://github.com/hack4impact/women-veterans-rock","homepage":null,"size":1351,"stargazers_count":3,"watchers_count":3,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":9,"forks":1,"open_issues":9,"watchers":3,"default_branch":"master"}},"base":{"label":"hack4impact:yoni-add-review","ref":"yoni-add-review","sha":"7f5f63aba8297fff01a5911a009be3bbe1c21076","user":{"login":"hack4impact","id":9021093,"avatar_url":"https://avatars.githubusercontent.com/u/9021093?v=3","gravatar_id":"","url":"https://api.github.com/users/hack4impact","html_url":"https://github.com/hack4impact","followers_url":"https://api.github.com/users/hack4impact/followers","following_url":"https://api.github.com/users/hack4impact/following{/other_user}","gists_url":"https://api.github.com/users/hack4impact/gists{/gist_id}","starred_url":"https://api.github.com/users/hack4impact/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hack4impact/subscriptions","organizations_url":"https://api.github.com/users/hack4impact/orgs","repos_url":"https://api.github.com/users/hack4impact/repos","events_url":"https://api.github.com/users/hack4impact/events{/privacy}","received_events_url":"https://api.github.com/users/hack4impact/received_events","type":"Organization","site_admin":false},"repo":{"id":43617101,"name":"women-veterans-rock","full_name":"hack4impact/women-veterans-rock","owner":{"login":"hack4impact","id":9021093,"avatar_url":"https://avatars.githubusercontent.com/u/9021093?v=3","gravatar_id":"","url":"https://api.github.com/users/hack4impact","html_url":"https://github.com/hack4impact","followers_url":"https://api.github.com/users/hack4impact/followers","following_url":"https://api.github.com/users/hack4impact/following{/other_user}","gists_url":"https://api.github.com/users/hack4impact/gists{/gist_id}","starred_url":"https://api.github.com/users/hack4impact/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hack4impact/subscriptions","organizations_url":"https://api.github.com/users/hack4impact/orgs","repos_url":"https://api.github.com/users/hack4impact/repos","events_url":"https://api.github.com/users/hack4impact/events{/privacy}","received_events_url":"https://api.github.com/users/hack4impact/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hack4impact/women-veterans-rock","description":"","fork":false,"url":"https://api.github.com/repos/hack4impact/women-veterans-rock","forks_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/forks","keys_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/teams","hooks_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/hooks","issue_events_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/issues/events{/number}","events_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/events","assignees_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/assignees{/user}","branches_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/branches{/branch}","tags_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/tags","blobs_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/git/refs{/sha}","trees_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/statuses/{sha}","languages_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/languages","stargazers_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/stargazers","contributors_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/contributors","subscribers_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/subscribers","subscription_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/subscription","commits_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/commits{/sha}","git_commits_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/git/commits{/sha}","comments_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/comments{/number}","issue_comment_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/issues/comments{/number}","contents_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/contents/{+path}","compare_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/merges","archive_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/downloads","issues_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/issues{/number}","pulls_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/pulls{/number}","milestones_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/milestones{/number}","notifications_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/labels{/name}","releases_url":"https://api.github.com/repos/hack4impact/women-veterans-rock/releases{/id}","created_at":"2015-10-03T22:21:16Z","updated_at":"2015-11-13T18:13:53Z","pushed_at":"2015-11-16T06:40:02Z","git_url":"git://github.com/hack4impact/women-veterans-rock.git","ssh_url":"git@github.com:hack4impact/women-veterans-rock.git","clone_url":"https://github.com/hack4impact/women-veterans-rock.git","svn_url":"https://github.com/hack4impact/women-veterans-rock","homepage":null,"size":1351,"stargazers_count":3,"watchers_count":3,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":9,"forks":1,"open_issues":9,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hack4impact/women-veterans-rock/pulls/20"},"html":{"href":"https://github.com/hack4impact/women-veterans-rock/pull/20"},"issue":{"href":"https://api.github.com/repos/hack4impact/women-veterans-rock/issues/20"},"comments":{"href":"https://api.github.com/repos/hack4impact/women-veterans-rock/issues/20/comments"},"review_comments":{"href":"https://api.github.com/repos/hack4impact/women-veterans-rock/pulls/20/comments"},"review_comment":{"href":"https://api.github.com/repos/hack4impact/women-veterans-rock/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hack4impact/women-veterans-rock/pulls/20/commits"},"statuses":{"href":"https://api.github.com/repos/hack4impact/women-veterans-rock/statuses/ed99ef6e6cdf6435d1e7385d4f02d42b1ff4fe58"}}}}