{"action":"created","comment":{"url":"https://api.github.com/repos/andela/ah-code-blooded/pulls/comments/223247091","pull_request_review_id":162327172,"id":223247091,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyMzI0NzA5MQ==","diff_hunk":"@@ -0,0 +1,69 @@\n+import random\n+import string\n+\n+from django.db import models\n+\n+# Create your models here.\n+from django.template.defaultfilters import slugify\n+\n+from authors.apps.core.models import BaseModel\n+\n+\n+class Article(BaseModel):\n+    \"\"\"\n+    Model for an article, extends a basemodel since the created and updated times are required\n+    \"\"\"\n+    slug = models.SlugField(max_length=255, unique=True, db_index=True)\n+    title = models.CharField(max_length=255)\n+    description = models.TextField()\n+    body = models.TextField()\n+    image = models.URLField(default='')\n+\n+    # The author Foreign Key should be bound to a user profile\n+    author = models.ForeignKey(\n+        'authentication.User',\n+        related_name='articles',\n+        on_delete=models.CASCADE\n+    )\n+    # a article contains many tags\n+    tags = models.ManyToManyField(\n+        'articles.Tag',\n+        related_name='articles',\n+    )\n+    published = models.BooleanField(default=False)\n+\n+    def save(self, *args, **kwargs):","path":"authors/apps/articles/models.py","position":34,"original_position":35,"commit_id":"50fdaec2286b529f016406f4bf6458049eaecd92","original_commit_id":"a8464f7a41c80489a599aed0c5be574f4b378953","user":{"login":"esirK","id":13068580,"node_id":"MDQ6VXNlcjEzMDY4NTgw","avatar_url":"https://avatars3.githubusercontent.com/u/13068580?v=4","gravatar_id":"","url":"https://api.github.com/users/esirK","html_url":"https://github.com/esirK","followers_url":"https://api.github.com/users/esirK/followers","following_url":"https://api.github.com/users/esirK/following{/other_user}","gists_url":"https://api.github.com/users/esirK/gists{/gist_id}","starred_url":"https://api.github.com/users/esirK/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/esirK/subscriptions","organizations_url":"https://api.github.com/users/esirK/orgs","repos_url":"https://api.github.com/users/esirK/repos","events_url":"https://api.github.com/users/esirK/events{/privacy}","received_events_url":"https://api.github.com/users/esirK/received_events","type":"User","site_admin":false},"body":"`DRF pre_save, post_save, pre_delete, post_delete` methods are different from  Django methods. `DRF pre_save, post_save, pre_delete, post_delete` act on `View` layer while the ones for Django act on the model layer which is what we want.","created_at":"2018-10-08T04:37:17Z","updated_at":"2018-10-08T04:37:17Z","html_url":"https://github.com/andela/ah-code-blooded/pull/20#discussion_r223247091","pull_request_url":"https://api.github.com/repos/andela/ah-code-blooded/pulls/20","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/andela/ah-code-blooded/pulls/comments/223247091"},"html":{"href":"https://github.com/andela/ah-code-blooded/pull/20#discussion_r223247091"},"pull_request":{"href":"https://api.github.com/repos/andela/ah-code-blooded/pulls/20"}},"in_reply_to_id":223240786},"pull_request":{"url":"https://api.github.com/repos/andela/ah-code-blooded/pulls/20","id":220192479,"node_id":"MDExOlB1bGxSZXF1ZXN0MjIwMTkyNDc5","html_url":"https://github.com/andela/ah-code-blooded/pull/20","diff_url":"https://github.com/andela/ah-code-blooded/pull/20.diff","patch_url":"https://github.com/andela/ah-code-blooded/pull/20.patch","issue_url":"https://api.github.com/repos/andela/ah-code-blooded/issues/20","number":20,"state":"open","locked":false,"title":"#160577612 Users can create articles","user":{"login":"gitaumoses4","id":25629064,"node_id":"MDQ6VXNlcjI1NjI5MDY0","avatar_url":"https://avatars2.githubusercontent.com/u/25629064?v=4","gravatar_id":"","url":"https://api.github.com/users/gitaumoses4","html_url":"https://github.com/gitaumoses4","followers_url":"https://api.github.com/users/gitaumoses4/followers","following_url":"https://api.github.com/users/gitaumoses4/following{/other_user}","gists_url":"https://api.github.com/users/gitaumoses4/gists{/gist_id}","starred_url":"https://api.github.com/users/gitaumoses4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gitaumoses4/subscriptions","organizations_url":"https://api.github.com/users/gitaumoses4/orgs","repos_url":"https://api.github.com/users/gitaumoses4/repos","events_url":"https://api.github.com/users/gitaumoses4/events{/privacy}","received_events_url":"https://api.github.com/users/gitaumoses4/received_events","type":"User","site_admin":false},"body":"## What does this PR do\r\nAllows users to create articles\r\nCreate tests for the article creation functionality\r\n\r\n## Description of task to be completed.\r\nHave the endpoint for creating and listing articles working.\r\nPerform the CRUD functionality on articles.\r\n\r\n## Endpoints\r\n| ENDPOINT                     | METHODS              | DESCRIPTION                                       |\r\n|------------------------------|----------------------|---------------------------------------------------|\r\n| /api/articles                | POST,GET             | List articles and create articles                 |\r\n| /api/articles/<article_slug> | GET,PUT,PATCH,DELETE | Retrieve an article, delete and update an article |\r\n\r\n## Creating an article\r\nThe following is the sample of a request data\r\n```\r\n{\r\n  \"article\": {\r\n    \"title\": \"How to train your dragon today\",\r\n    \"description\": \"Ever wonder how?\",\r\n    \"body\": \"You have to believe in you\",\r\n    \"tags\": [\"reactjs\", \"angularjs\", \"dragons\"],\r\n    \"image\": \"https://dummyimage.com/600x400/000/fff\",\r\n    \"published\": true\r\n  }\r\n}\r\n```\r\n\r\n## Response\r\n```\r\n{\r\n    \"status\": \"success\",\r\n    \"data\": {\r\n        \"article\": {\r\n            \"slug\": \"how-to-train-your-dragon-today-oyj949clezmc\",\r\n            \"title\": \"How to train your dragon today\",\r\n            \"description\": \"Ever wonder how?\",\r\n            \"body\": \"You have to believe in you\",\r\n            \"published\": true,\r\n            \"author\": 19,\r\n            \"image\": \"https://dummyimage.com/600x400/000/fff\",\r\n            \"created_at\": \"2018-10-03T21:13:28.059255Z\",\r\n            \"updated_at\": \"2018-10-03T21:35:24.707971Z\",\r\n            \"tags\": [\r\n                \"nodejs\",\r\n                \"dragons\",\r\n                \"angularjs\",\r\n                \"reactjs\"\r\n            ]\r\n        }\r\n    }\r\n}\r\n```\r\n\r\n## Background context\r\nThe `author` field will be updated as soon as the profile task is completed.\r\n\r\n## Disclaimer\r\nMore tests are currently underway, functionality will be enhanced as I write the tests.\r\n\r\n## Screenshots\r\n![screen shot 2018-10-04 at 00 54 27 2](https://user-images.githubusercontent.com/25629064/46441727-122cf180-c770-11e8-8e2f-f01c45f3663d.png)\r\n\r\n## Relevant Pivotal Tracker Stories\r\n[#160577612](https://www.pivotaltracker.com/story/show/160577612)","created_at":"2018-10-03T21:56:18Z","updated_at":"2018-10-08T04:37:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cbdb8ebf2ae5f2c73db671836887dec0cc857722","assignee":null,"assignees":[],"requested_reviewers":[{"login":"bevkololi","id":26184534,"node_id":"MDQ6VXNlcjI2MTg0NTM0","avatar_url":"https://avatars1.githubusercontent.com/u/26184534?v=4","gravatar_id":"","url":"https://api.github.com/users/bevkololi","html_url":"https://github.com/bevkololi","followers_url":"https://api.github.com/users/bevkololi/followers","following_url":"https://api.github.com/users/bevkololi/following{/other_user}","gists_url":"https://api.github.com/users/bevkololi/gists{/gist_id}","starred_url":"https://api.github.com/users/bevkololi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bevkololi/subscriptions","organizations_url":"https://api.github.com/users/bevkololi/orgs","repos_url":"https://api.github.com/users/bevkololi/repos","events_url":"https://api.github.com/users/bevkololi/events{/privacy}","received_events_url":"https://api.github.com/users/bevkololi/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/andela/ah-code-blooded/pulls/20/commits","review_comments_url":"https://api.github.com/repos/andela/ah-code-blooded/pulls/20/comments","review_comment_url":"https://api.github.com/repos/andela/ah-code-blooded/pulls/comments{/number}","comments_url":"https://api.github.com/repos/andela/ah-code-blooded/issues/20/comments","statuses_url":"https://api.github.com/repos/andela/ah-code-blooded/statuses/50fdaec2286b529f016406f4bf6458049eaecd92","head":{"label":"andela:ft-create-articles-160577612","ref":"ft-create-articles-160577612","sha":"50fdaec2286b529f016406f4bf6458049eaecd92","user":{"login":"andela","id":4100206,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQxMDAyMDY=","avatar_url":"https://avatars2.githubusercontent.com/u/4100206?v=4","gravatar_id":"","url":"https://api.github.com/users/andela","html_url":"https://github.com/andela","followers_url":"https://api.github.com/users/andela/followers","following_url":"https://api.github.com/users/andela/following{/other_user}","gists_url":"https://api.github.com/users/andela/gists{/gist_id}","starred_url":"https://api.github.com/users/andela/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela/subscriptions","organizations_url":"https://api.github.com/users/andela/orgs","repos_url":"https://api.github.com/users/andela/repos","events_url":"https://api.github.com/users/andela/events{/privacy}","received_events_url":"https://api.github.com/users/andela/received_events","type":"Organization","site_admin":false},"repo":{"id":149583386,"node_id":"MDEwOlJlcG9zaXRvcnkxNDk1ODMzODY=","name":"ah-code-blooded","full_name":"andela/ah-code-blooded","private":false,"owner":{"login":"andela","id":4100206,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQxMDAyMDY=","avatar_url":"https://avatars2.githubusercontent.com/u/4100206?v=4","gravatar_id":"","url":"https://api.github.com/users/andela","html_url":"https://github.com/andela","followers_url":"https://api.github.com/users/andela/followers","following_url":"https://api.github.com/users/andela/following{/other_user}","gists_url":"https://api.github.com/users/andela/gists{/gist_id}","starred_url":"https://api.github.com/users/andela/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela/subscriptions","organizations_url":"https://api.github.com/users/andela/orgs","repos_url":"https://api.github.com/users/andela/repos","events_url":"https://api.github.com/users/andela/events{/privacy}","received_events_url":"https://api.github.com/users/andela/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/andela/ah-code-blooded","description":null,"fork":false,"url":"https://api.github.com/repos/andela/ah-code-blooded","forks_url":"https://api.github.com/repos/andela/ah-code-blooded/forks","keys_url":"https://api.github.com/repos/andela/ah-code-blooded/keys{/key_id}","collaborators_url":"https://api.github.com/repos/andela/ah-code-blooded/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/andela/ah-code-blooded/teams","hooks_url":"https://api.github.com/repos/andela/ah-code-blooded/hooks","issue_events_url":"https://api.github.com/repos/andela/ah-code-blooded/issues/events{/number}","events_url":"https://api.github.com/repos/andela/ah-code-blooded/events","assignees_url":"https://api.github.com/repos/andela/ah-code-blooded/assignees{/user}","branches_url":"https://api.github.com/repos/andela/ah-code-blooded/branches{/branch}","tags_url":"https://api.github.com/repos/andela/ah-code-blooded/tags","blobs_url":"https://api.github.com/repos/andela/ah-code-blooded/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/andela/ah-code-blooded/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/andela/ah-code-blooded/git/refs{/sha}","trees_url":"https://api.github.com/repos/andela/ah-code-blooded/git/trees{/sha}","statuses_url":"https://api.github.com/repos/andela/ah-code-blooded/statuses/{sha}","languages_url":"https://api.github.com/repos/andela/ah-code-blooded/languages","stargazers_url":"https://api.github.com/repos/andela/ah-code-blooded/stargazers","contributors_url":"https://api.github.com/repos/andela/ah-code-blooded/contributors","subscribers_url":"https://api.github.com/repos/andela/ah-code-blooded/subscribers","subscription_url":"https://api.github.com/repos/andela/ah-code-blooded/subscription","commits_url":"https://api.github.com/repos/andela/ah-code-blooded/commits{/sha}","git_commits_url":"https://api.github.com/repos/andela/ah-code-blooded/git/commits{/sha}","comments_url":"https://api.github.com/repos/andela/ah-code-blooded/comments{/number}","issue_comment_url":"https://api.github.com/repos/andela/ah-code-blooded/issues/comments{/number}","contents_url":"https://api.github.com/repos/andela/ah-code-blooded/contents/{+path}","compare_url":"https://api.github.com/repos/andela/ah-code-blooded/compare/{base}...{head}","merges_url":"https://api.github.com/repos/andela/ah-code-blooded/merges","archive_url":"https://api.github.com/repos/andela/ah-code-blooded/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/andela/ah-code-blooded/downloads","issues_url":"https://api.github.com/repos/andela/ah-code-blooded/issues{/number}","pulls_url":"https://api.github.com/repos/andela/ah-code-blooded/pulls{/number}","milestones_url":"https://api.github.com/repos/andela/ah-code-blooded/milestones{/number}","notifications_url":"https://api.github.com/repos/andela/ah-code-blooded/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/andela/ah-code-blooded/labels{/name}","releases_url":"https://api.github.com/repos/andela/ah-code-blooded/releases{/id}","deployments_url":"https://api.github.com/repos/andela/ah-code-blooded/deployments","created_at":"2018-09-20T09:17:10Z","updated_at":"2018-09-26T11:39:04Z","pushed_at":"2018-10-08T03:20:05Z","git_url":"git://github.com/andela/ah-code-blooded.git","ssh_url":"git@github.com:andela/ah-code-blooded.git","clone_url":"https://github.com/andela/ah-code-blooded.git","svn_url":"https://github.com/andela/ah-code-blooded","homepage":null,"size":203,"stargazers_count":2,"watchers_count":2,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":4,"license":{"key":"bsd-3-clause","name":"BSD 3-Clause \"New\" or \"Revised\" License","spdx_id":"BSD-3-Clause","url":"https://api.github.com/licenses/bsd-3-clause","node_id":"MDc6TGljZW5zZTU="},"forks":0,"open_issues":4,"watchers":2,"default_branch":"master"}},"base":{"label":"andela:develop","ref":"develop","sha":"1232dcbdad69fbce9d5cca0a6d6e97e67f646b3d","user":{"login":"andela","id":4100206,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQxMDAyMDY=","avatar_url":"https://avatars2.githubusercontent.com/u/4100206?v=4","gravatar_id":"","url":"https://api.github.com/users/andela","html_url":"https://github.com/andela","followers_url":"https://api.github.com/users/andela/followers","following_url":"https://api.github.com/users/andela/following{/other_user}","gists_url":"https://api.github.com/users/andela/gists{/gist_id}","starred_url":"https://api.github.com/users/andela/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela/subscriptions","organizations_url":"https://api.github.com/users/andela/orgs","repos_url":"https://api.github.com/users/andela/repos","events_url":"https://api.github.com/users/andela/events{/privacy}","received_events_url":"https://api.github.com/users/andela/received_events","type":"Organization","site_admin":false},"repo":{"id":149583386,"node_id":"MDEwOlJlcG9zaXRvcnkxNDk1ODMzODY=","name":"ah-code-blooded","full_name":"andela/ah-code-blooded","private":false,"owner":{"login":"andela","id":4100206,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQxMDAyMDY=","avatar_url":"https://avatars2.githubusercontent.com/u/4100206?v=4","gravatar_id":"","url":"https://api.github.com/users/andela","html_url":"https://github.com/andela","followers_url":"https://api.github.com/users/andela/followers","following_url":"https://api.github.com/users/andela/following{/other_user}","gists_url":"https://api.github.com/users/andela/gists{/gist_id}","starred_url":"https://api.github.com/users/andela/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela/subscriptions","organizations_url":"https://api.github.com/users/andela/orgs","repos_url":"https://api.github.com/users/andela/repos","events_url":"https://api.github.com/users/andela/events{/privacy}","received_events_url":"https://api.github.com/users/andela/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/andela/ah-code-blooded","description":null,"fork":false,"url":"https://api.github.com/repos/andela/ah-code-blooded","forks_url":"https://api.github.com/repos/andela/ah-code-blooded/forks","keys_url":"https://api.github.com/repos/andela/ah-code-blooded/keys{/key_id}","collaborators_url":"https://api.github.com/repos/andela/ah-code-blooded/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/andela/ah-code-blooded/teams","hooks_url":"https://api.github.com/repos/andela/ah-code-blooded/hooks","issue_events_url":"https://api.github.com/repos/andela/ah-code-blooded/issues/events{/number}","events_url":"https://api.github.com/repos/andela/ah-code-blooded/events","assignees_url":"https://api.github.com/repos/andela/ah-code-blooded/assignees{/user}","branches_url":"https://api.github.com/repos/andela/ah-code-blooded/branches{/branch}","tags_url":"https://api.github.com/repos/andela/ah-code-blooded/tags","blobs_url":"https://api.github.com/repos/andela/ah-code-blooded/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/andela/ah-code-blooded/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/andela/ah-code-blooded/git/refs{/sha}","trees_url":"https://api.github.com/repos/andela/ah-code-blooded/git/trees{/sha}","statuses_url":"https://api.github.com/repos/andela/ah-code-blooded/statuses/{sha}","languages_url":"https://api.github.com/repos/andela/ah-code-blooded/languages","stargazers_url":"https://api.github.com/repos/andela/ah-code-blooded/stargazers","contributors_url":"https://api.github.com/repos/andela/ah-code-blooded/contributors","subscribers_url":"https://api.github.com/repos/andela/ah-code-blooded/subscribers","subscription_url":"https://api.github.com/repos/andela/ah-code-blooded/subscription","commits_url":"https://api.github.com/repos/andela/ah-code-blooded/commits{/sha}","git_commits_url":"https://api.github.com/repos/andela/ah-code-blooded/git/commits{/sha}","comments_url":"https://api.github.com/repos/andela/ah-code-blooded/comments{/number}","issue_comment_url":"https://api.github.com/repos/andela/ah-code-blooded/issues/comments{/number}","contents_url":"https://api.github.com/repos/andela/ah-code-blooded/contents/{+path}","compare_url":"https://api.github.com/repos/andela/ah-code-blooded/compare/{base}...{head}","merges_url":"https://api.github.com/repos/andela/ah-code-blooded/merges","archive_url":"https://api.github.com/repos/andela/ah-code-blooded/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/andela/ah-code-blooded/downloads","issues_url":"https://api.github.com/repos/andela/ah-code-blooded/issues{/number}","pulls_url":"https://api.github.com/repos/andela/ah-code-blooded/pulls{/number}","milestones_url":"https://api.github.com/repos/andela/ah-code-blooded/milestones{/number}","notifications_url":"https://api.github.com/repos/andela/ah-code-blooded/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/andela/ah-code-blooded/labels{/name}","releases_url":"https://api.github.com/repos/andela/ah-code-blooded/releases{/id}","deployments_url":"https://api.github.com/repos/andela/ah-code-blooded/deployments","created_at":"2018-09-20T09:17:10Z","updated_at":"2018-09-26T11:39:04Z","pushed_at":"2018-10-08T03:20:05Z","git_url":"git://github.com/andela/ah-code-blooded.git","ssh_url":"git@github.com:andela/ah-code-blooded.git","clone_url":"https://github.com/andela/ah-code-blooded.git","svn_url":"https://github.com/andela/ah-code-blooded","homepage":null,"size":203,"stargazers_count":2,"watchers_count":2,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":4,"license":{"key":"bsd-3-clause","name":"BSD 3-Clause \"New\" or \"Revised\" License","spdx_id":"BSD-3-Clause","url":"https://api.github.com/licenses/bsd-3-clause","node_id":"MDc6TGljZW5zZTU="},"forks":0,"open_issues":4,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/andela/ah-code-blooded/pulls/20"},"html":{"href":"https://github.com/andela/ah-code-blooded/pull/20"},"issue":{"href":"https://api.github.com/repos/andela/ah-code-blooded/issues/20"},"comments":{"href":"https://api.github.com/repos/andela/ah-code-blooded/issues/20/comments"},"review_comments":{"href":"https://api.github.com/repos/andela/ah-code-blooded/pulls/20/comments"},"review_comment":{"href":"https://api.github.com/repos/andela/ah-code-blooded/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/andela/ah-code-blooded/pulls/20/commits"},"statuses":{"href":"https://api.github.com/repos/andela/ah-code-blooded/statuses/50fdaec2286b529f016406f4bf6458049eaecd92"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"esirK"}}