{"action":"created","comment":{"url":"https://api.github.com/repos/henryyang42/NTHU_Course/pulls/comments/31884712","id":31884712,"diff_hunk":"@@ -105,13 +107,36 @@ def syllabus(request, id):\n                   {'course': course, 'syllabus_path': request.path})\n \n \n-def hit(request, id):\n-    course = get_object_or_404(Course, id=id)\n-    course.hit += 1\n-    course.save()\n+def course_manipulation(request, id):\n+    \"\"\" Use this `course_manipulation` function to record the course \"\"\"\n+    if request.user.is_authenticated():\n+        current_user = Member.objects.get(user=request.user)\n+        course = get_object_or_404(Course, id=id)\n+        request_type = request.GET.get('type', 'GET')\n+\n+        if request_type == 'POST':\n+            current_user.courses.add(course)\n+        elif request_type == 'DELETE':\n+            current_user.courses.remove(course)","path":"search/views.py","position":27,"original_position":27,"commit_id":"4974ea1e533982bab6d1ed3ff26b8c73d677bc85","original_commit_id":"4974ea1e533982bab6d1ed3ff26b8c73d677bc85","user":{"login":"leVirve","id":7029882,"avatar_url":"https://avatars.githubusercontent.com/u/7029882?v=3","gravatar_id":"","url":"https://api.github.com/users/leVirve","html_url":"https://github.com/leVirve","followers_url":"https://api.github.com/users/leVirve/followers","following_url":"https://api.github.com/users/leVirve/following{/other_user}","gists_url":"https://api.github.com/users/leVirve/gists{/gist_id}","starred_url":"https://api.github.com/users/leVirve/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leVirve/subscriptions","organizations_url":"https://api.github.com/users/leVirve/orgs","repos_url":"https://api.github.com/users/leVirve/repos","events_url":"https://api.github.com/users/leVirve/events{/privacy}","received_events_url":"https://api.github.com/users/leVirve/received_events","type":"User","site_admin":false},"body":"No, Django `request.method` only support `GET`, `POST`, right ?\r\n\r\nAnd what's the magic of reverse lookup ? Does that mean `request.user` can refer to its predecessor `member` ? Not quite familar with Django, first time on it :cry: ","created_at":"2015-06-08T02:31:32Z","updated_at":"2015-06-08T02:31:32Z","html_url":"https://github.com/henryyang42/NTHU_Course/pull/53#discussion_r31884712","pull_request_url":"https://api.github.com/repos/henryyang42/NTHU_Course/pulls/53","_links":{"self":{"href":"https://api.github.com/repos/henryyang42/NTHU_Course/pulls/comments/31884712"},"html":{"href":"https://github.com/henryyang42/NTHU_Course/pull/53#discussion_r31884712"},"pull_request":{"href":"https://api.github.com/repos/henryyang42/NTHU_Course/pulls/53"}}},"pull_request":{"url":"https://api.github.com/repos/henryyang42/NTHU_Course/pulls/53","id":37110717,"html_url":"https://github.com/henryyang42/NTHU_Course/pull/53","diff_url":"https://github.com/henryyang42/NTHU_Course/pull/53.diff","patch_url":"https://github.com/henryyang42/NTHU_Course/pull/53.patch","issue_url":"https://api.github.com/repos/henryyang42/NTHU_Course/issues/53","number":53,"state":"open","locked":false,"title":"Facebook OAuth and data sync","user":{"login":"leVirve","id":7029882,"avatar_url":"https://avatars.githubusercontent.com/u/7029882?v=3","gravatar_id":"","url":"https://api.github.com/users/leVirve","html_url":"https://github.com/leVirve","followers_url":"https://api.github.com/users/leVirve/followers","following_url":"https://api.github.com/users/leVirve/following{/other_user}","gists_url":"https://api.github.com/users/leVirve/gists{/gist_id}","starred_url":"https://api.github.com/users/leVirve/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leVirve/subscriptions","organizations_url":"https://api.github.com/users/leVirve/orgs","repos_url":"https://api.github.com/users/leVirve/repos","events_url":"https://api.github.com/users/leVirve/events{/privacy}","received_events_url":"https://api.github.com/users/leVirve/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-06-07T18:11:21Z","updated_at":"2015-06-08T02:31:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9cbe7af0ff45ed930dd3e551fa7288cdd842b9bb","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/henryyang42/NTHU_Course/pulls/53/commits","review_comments_url":"https://api.github.com/repos/henryyang42/NTHU_Course/pulls/53/comments","review_comment_url":"https://api.github.com/repos/henryyang42/NTHU_Course/pulls/comments{/number}","comments_url":"https://api.github.com/repos/henryyang42/NTHU_Course/issues/53/comments","statuses_url":"https://api.github.com/repos/henryyang42/NTHU_Course/statuses/4974ea1e533982bab6d1ed3ff26b8c73d677bc85","head":{"label":"leVirve:master","ref":"master","sha":"4974ea1e533982bab6d1ed3ff26b8c73d677bc85","user":{"login":"leVirve","id":7029882,"avatar_url":"https://avatars.githubusercontent.com/u/7029882?v=3","gravatar_id":"","url":"https://api.github.com/users/leVirve","html_url":"https://github.com/leVirve","followers_url":"https://api.github.com/users/leVirve/followers","following_url":"https://api.github.com/users/leVirve/following{/other_user}","gists_url":"https://api.github.com/users/leVirve/gists{/gist_id}","starred_url":"https://api.github.com/users/leVirve/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leVirve/subscriptions","organizations_url":"https://api.github.com/users/leVirve/orgs","repos_url":"https://api.github.com/users/leVirve/repos","events_url":"https://api.github.com/users/leVirve/events{/privacy}","received_events_url":"https://api.github.com/users/leVirve/received_events","type":"User","site_admin":false},"repo":{"id":36451731,"name":"NTHU_Course","full_name":"leVirve/NTHU_Course","owner":{"login":"leVirve","id":7029882,"avatar_url":"https://avatars.githubusercontent.com/u/7029882?v=3","gravatar_id":"","url":"https://api.github.com/users/leVirve","html_url":"https://github.com/leVirve","followers_url":"https://api.github.com/users/leVirve/followers","following_url":"https://api.github.com/users/leVirve/following{/other_user}","gists_url":"https://api.github.com/users/leVirve/gists{/gist_id}","starred_url":"https://api.github.com/users/leVirve/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leVirve/subscriptions","organizations_url":"https://api.github.com/users/leVirve/orgs","repos_url":"https://api.github.com/users/leVirve/repos","events_url":"https://api.github.com/users/leVirve/events{/privacy}","received_events_url":"https://api.github.com/users/leVirve/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/leVirve/NTHU_Course","description":"","fork":true,"url":"https://api.github.com/repos/leVirve/NTHU_Course","forks_url":"https://api.github.com/repos/leVirve/NTHU_Course/forks","keys_url":"https://api.github.com/repos/leVirve/NTHU_Course/keys{/key_id}","collaborators_url":"https://api.github.com/repos/leVirve/NTHU_Course/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/leVirve/NTHU_Course/teams","hooks_url":"https://api.github.com/repos/leVirve/NTHU_Course/hooks","issue_events_url":"https://api.github.com/repos/leVirve/NTHU_Course/issues/events{/number}","events_url":"https://api.github.com/repos/leVirve/NTHU_Course/events","assignees_url":"https://api.github.com/repos/leVirve/NTHU_Course/assignees{/user}","branches_url":"https://api.github.com/repos/leVirve/NTHU_Course/branches{/branch}","tags_url":"https://api.github.com/repos/leVirve/NTHU_Course/tags","blobs_url":"https://api.github.com/repos/leVirve/NTHU_Course/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/leVirve/NTHU_Course/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/leVirve/NTHU_Course/git/refs{/sha}","trees_url":"https://api.github.com/repos/leVirve/NTHU_Course/git/trees{/sha}","statuses_url":"https://api.github.com/repos/leVirve/NTHU_Course/statuses/{sha}","languages_url":"https://api.github.com/repos/leVirve/NTHU_Course/languages","stargazers_url":"https://api.github.com/repos/leVirve/NTHU_Course/stargazers","contributors_url":"https://api.github.com/repos/leVirve/NTHU_Course/contributors","subscribers_url":"https://api.github.com/repos/leVirve/NTHU_Course/subscribers","subscription_url":"https://api.github.com/repos/leVirve/NTHU_Course/subscription","commits_url":"https://api.github.com/repos/leVirve/NTHU_Course/commits{/sha}","git_commits_url":"https://api.github.com/repos/leVirve/NTHU_Course/git/commits{/sha}","comments_url":"https://api.github.com/repos/leVirve/NTHU_Course/comments{/number}","issue_comment_url":"https://api.github.com/repos/leVirve/NTHU_Course/issues/comments{/number}","contents_url":"https://api.github.com/repos/leVirve/NTHU_Course/contents/{+path}","compare_url":"https://api.github.com/repos/leVirve/NTHU_Course/compare/{base}...{head}","merges_url":"https://api.github.com/repos/leVirve/NTHU_Course/merges","archive_url":"https://api.github.com/repos/leVirve/NTHU_Course/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/leVirve/NTHU_Course/downloads","issues_url":"https://api.github.com/repos/leVirve/NTHU_Course/issues{/number}","pulls_url":"https://api.github.com/repos/leVirve/NTHU_Course/pulls{/number}","milestones_url":"https://api.github.com/repos/leVirve/NTHU_Course/milestones{/number}","notifications_url":"https://api.github.com/repos/leVirve/NTHU_Course/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/leVirve/NTHU_Course/labels{/name}","releases_url":"https://api.github.com/repos/leVirve/NTHU_Course/releases{/id}","created_at":"2015-05-28T16:32:32Z","updated_at":"2015-05-28T16:32:32Z","pushed_at":"2015-06-07T18:09:09Z","git_url":"git://github.com/leVirve/NTHU_Course.git","ssh_url":"git@github.com:leVirve/NTHU_Course.git","clone_url":"https://github.com/leVirve/NTHU_Course.git","svn_url":"https://github.com/leVirve/NTHU_Course","homepage":"http://nthu-course.cf/","size":15030,"stargazers_count":0,"watchers_count":0,"language":"CSS","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"henryyang42:dev","ref":"dev","sha":"416eb15ba5c36345cbe6912101ee2c6c0751c83a","user":{"login":"henryyang42","id":6128538,"avatar_url":"https://avatars.githubusercontent.com/u/6128538?v=3","gravatar_id":"","url":"https://api.github.com/users/henryyang42","html_url":"https://github.com/henryyang42","followers_url":"https://api.github.com/users/henryyang42/followers","following_url":"https://api.github.com/users/henryyang42/following{/other_user}","gists_url":"https://api.github.com/users/henryyang42/gists{/gist_id}","starred_url":"https://api.github.com/users/henryyang42/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/henryyang42/subscriptions","organizations_url":"https://api.github.com/users/henryyang42/orgs","repos_url":"https://api.github.com/users/henryyang42/repos","events_url":"https://api.github.com/users/henryyang42/events{/privacy}","received_events_url":"https://api.github.com/users/henryyang42/received_events","type":"User","site_admin":false},"repo":{"id":34732207,"name":"NTHU_Course","full_name":"henryyang42/NTHU_Course","owner":{"login":"henryyang42","id":6128538,"avatar_url":"https://avatars.githubusercontent.com/u/6128538?v=3","gravatar_id":"","url":"https://api.github.com/users/henryyang42","html_url":"https://github.com/henryyang42","followers_url":"https://api.github.com/users/henryyang42/followers","following_url":"https://api.github.com/users/henryyang42/following{/other_user}","gists_url":"https://api.github.com/users/henryyang42/gists{/gist_id}","starred_url":"https://api.github.com/users/henryyang42/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/henryyang42/subscriptions","organizations_url":"https://api.github.com/users/henryyang42/orgs","repos_url":"https://api.github.com/users/henryyang42/repos","events_url":"https://api.github.com/users/henryyang42/events{/privacy}","received_events_url":"https://api.github.com/users/henryyang42/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/henryyang42/NTHU_Course","description":"","fork":false,"url":"https://api.github.com/repos/henryyang42/NTHU_Course","forks_url":"https://api.github.com/repos/henryyang42/NTHU_Course/forks","keys_url":"https://api.github.com/repos/henryyang42/NTHU_Course/keys{/key_id}","collaborators_url":"https://api.github.com/repos/henryyang42/NTHU_Course/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/henryyang42/NTHU_Course/teams","hooks_url":"https://api.github.com/repos/henryyang42/NTHU_Course/hooks","issue_events_url":"https://api.github.com/repos/henryyang42/NTHU_Course/issues/events{/number}","events_url":"https://api.github.com/repos/henryyang42/NTHU_Course/events","assignees_url":"https://api.github.com/repos/henryyang42/NTHU_Course/assignees{/user}","branches_url":"https://api.github.com/repos/henryyang42/NTHU_Course/branches{/branch}","tags_url":"https://api.github.com/repos/henryyang42/NTHU_Course/tags","blobs_url":"https://api.github.com/repos/henryyang42/NTHU_Course/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/henryyang42/NTHU_Course/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/henryyang42/NTHU_Course/git/refs{/sha}","trees_url":"https://api.github.com/repos/henryyang42/NTHU_Course/git/trees{/sha}","statuses_url":"https://api.github.com/repos/henryyang42/NTHU_Course/statuses/{sha}","languages_url":"https://api.github.com/repos/henryyang42/NTHU_Course/languages","stargazers_url":"https://api.github.com/repos/henryyang42/NTHU_Course/stargazers","contributors_url":"https://api.github.com/repos/henryyang42/NTHU_Course/contributors","subscribers_url":"https://api.github.com/repos/henryyang42/NTHU_Course/subscribers","subscription_url":"https://api.github.com/repos/henryyang42/NTHU_Course/subscription","commits_url":"https://api.github.com/repos/henryyang42/NTHU_Course/commits{/sha}","git_commits_url":"https://api.github.com/repos/henryyang42/NTHU_Course/git/commits{/sha}","comments_url":"https://api.github.com/repos/henryyang42/NTHU_Course/comments{/number}","issue_comment_url":"https://api.github.com/repos/henryyang42/NTHU_Course/issues/comments{/number}","contents_url":"https://api.github.com/repos/henryyang42/NTHU_Course/contents/{+path}","compare_url":"https://api.github.com/repos/henryyang42/NTHU_Course/compare/{base}...{head}","merges_url":"https://api.github.com/repos/henryyang42/NTHU_Course/merges","archive_url":"https://api.github.com/repos/henryyang42/NTHU_Course/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/henryyang42/NTHU_Course/downloads","issues_url":"https://api.github.com/repos/henryyang42/NTHU_Course/issues{/number}","pulls_url":"https://api.github.com/repos/henryyang42/NTHU_Course/pulls{/number}","milestones_url":"https://api.github.com/repos/henryyang42/NTHU_Course/milestones{/number}","notifications_url":"https://api.github.com/repos/henryyang42/NTHU_Course/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/henryyang42/NTHU_Course/labels{/name}","releases_url":"https://api.github.com/repos/henryyang42/NTHU_Course/releases{/id}","created_at":"2015-04-28T13:30:38Z","updated_at":"2015-06-01T01:41:44Z","pushed_at":"2015-06-07T18:11:21Z","git_url":"git://github.com/henryyang42/NTHU_Course.git","ssh_url":"git@github.com:henryyang42/NTHU_Course.git","clone_url":"https://github.com/henryyang42/NTHU_Course.git","svn_url":"https://github.com/henryyang42/NTHU_Course","homepage":"http://nthu-course.cf/","size":15438,"stargazers_count":4,"watchers_count":4,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":5,"forks":5,"open_issues":5,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/henryyang42/NTHU_Course/pulls/53"},"html":{"href":"https://github.com/henryyang42/NTHU_Course/pull/53"},"issue":{"href":"https://api.github.com/repos/henryyang42/NTHU_Course/issues/53"},"comments":{"href":"https://api.github.com/repos/henryyang42/NTHU_Course/issues/53/comments"},"review_comments":{"href":"https://api.github.com/repos/henryyang42/NTHU_Course/pulls/53/comments"},"review_comment":{"href":"https://api.github.com/repos/henryyang42/NTHU_Course/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/henryyang42/NTHU_Course/pulls/53/commits"},"statuses":{"href":"https://api.github.com/repos/henryyang42/NTHU_Course/statuses/4974ea1e533982bab6d1ed3ff26b8c73d677bc85"}}}}