GitHub PullRequestReviewCommentEvent at 2014-12-27 20:56:07
Repository: uw-message-coding
Actor: michaelbrooks
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/pulls/comments/22294569","id":22294569,"diff_hunk":"@@ -3,26 +3,26 @@\n \n from base.models import NameDescriptionMixin, CreatedAtField\n from django.core.urlresolvers import reverse\n+from django.core.exceptions import ValidationError\n+\n+# These strings cannot be dataset slugs\n+illegal_dataset_slugs = (\n+    'import',\n+)\n+\n+\n+def slug_validator(value):\n+    if value in illegal_dataset_slugs:\n+        raise ValidationError(\"%s cannot be used as a dataset code\" % value)\n \n \n class Dataset(NameDescriptionMixin):\n     \"\"\"Defines a dataset imported into a project by a user.\"\"\"\n \n+    slug = models.SlugField(unique=True, validators=[slug_validator])\n     created_at = CreatedAtField()\n     owner = models.ForeignKey(settings.AUTH_USER_MODEL)\n     projects = models.ManyToManyField('project.Project', related_name='datasets')\n-    def get_absolute_url(self):\n-        \"\"\"What is the main url for this object\"\"\"\n-        return reverse('dataset', kwargs={\n-            'pk': self.pk,\n-        })\n-\n-\n-    def get_absolute_url(self):\n-        \"\"\"What is the main url for this object\"\"\"\n-        return reverse('dataset_details', kwargs={\n-            'dataset_pk': self.pk,\n-        })    ","path":"message_coding/apps/dataset/models.py","position":35,"original_position":35,"commit_id":"f04f5c1c3480241de4d2ffc27317cc3319d43690","original_commit_id":"f04f5c1c3480241de4d2ffc27317cc3319d43690","user":{"login":"michaelbrooks","id":1330400,"avatar_url":"https://avatars.githubusercontent.com/u/1330400?v=3","gravatar_id":"","url":"https://api.github.com/users/michaelbrooks","html_url":"https://github.com/michaelbrooks","followers_url":"https://api.github.com/users/michaelbrooks/followers","following_url":"https://api.github.com/users/michaelbrooks/following{/other_user}","gists_url":"https://api.github.com/users/michaelbrooks/gists{/gist_id}","starred_url":"https://api.github.com/users/michaelbrooks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaelbrooks/subscriptions","organizations_url":"https://api.github.com/users/michaelbrooks/orgs","repos_url":"https://api.github.com/users/michaelbrooks/repos","events_url":"https://api.github.com/users/michaelbrooks/events{/privacy}","received_events_url":"https://api.github.com/users/michaelbrooks/received_events","type":"User","site_admin":false},"body":"I removed the above (duplicate) implementations of get_absolute_url because now that the dataset is nested inside of the projects, there is no absolute url for datasets independent of a project context.","created_at":"2014-12-27T20:56:07Z","updated_at":"2014-12-27T20:56:07Z","html_url":"https://github.com/michaelbrooks/uw-message-coding/pull/30#discussion_r22294569","pull_request_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/pulls/30","_links":{"self":{"href":"https://api.github.com/repos/michaelbrooks/uw-message-coding/pulls/comments/22294569"},"html":{"href":"https://github.com/michaelbrooks/uw-message-coding/pull/30#discussion_r22294569"},"pull_request":{"href":"https://api.github.com/repos/michaelbrooks/uw-message-coding/pulls/30"}}},"pull_request":{"url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/pulls/30","id":26617983,"html_url":"https://github.com/michaelbrooks/uw-message-coding/pull/30","diff_url":"https://github.com/michaelbrooks/uw-message-coding/pull/30.diff","patch_url":"https://github.com/michaelbrooks/uw-message-coding/pull/30.patch","issue_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/issues/30","number":30,"state":"open","locked":false,"title":"Add slugs to project and dataset models","user":{"login":"michaelbrooks","id":1330400,"avatar_url":"https://avatars.githubusercontent.com/u/1330400?v=3","gravatar_id":"","url":"https://api.github.com/users/michaelbrooks","html_url":"https://github.com/michaelbrooks","followers_url":"https://api.github.com/users/michaelbrooks/followers","following_url":"https://api.github.com/users/michaelbrooks/following{/other_user}","gists_url":"https://api.github.com/users/michaelbrooks/gists{/gist_id}","starred_url":"https://api.github.com/users/michaelbrooks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaelbrooks/subscriptions","organizations_url":"https://api.github.com/users/michaelbrooks/orgs","repos_url":"https://api.github.com/users/michaelbrooks/repos","events_url":"https://api.github.com/users/michaelbrooks/events{/privacy}","received_events_url":"https://api.github.com/users/michaelbrooks/received_events","type":"User","site_admin":false},"body":"This is part of the work for #24.\r\n\r\nI have added SlugFields to the Project and Dataset models. There are four new migrations that effect these changes in the database. See detailed explanation below.\r\n\r\nThere is also validation to ensure that the slugs do not conflict with other urls we may have in the application. For example, you couldn't create a project with slug \"admin\" because it would use the url \"http://localhost/admin\", which is reserved.","created_at":"2014-12-27T20:54:09Z","updated_at":"2014-12-27T20:56:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"34a54c757b0349be47ff53d44ba24d5341d683a6","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/pulls/30/commits","review_comments_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/pulls/30/comments","review_comment_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/pulls/comments/{number}","comments_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/issues/30/comments","statuses_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/statuses/f04f5c1c3480241de4d2ffc27317cc3319d43690","head":{"label":"michaelbrooks:project-urls-model-slugs","ref":"project-urls-model-slugs","sha":"f04f5c1c3480241de4d2ffc27317cc3319d43690","user":{"login":"michaelbrooks","id":1330400,"avatar_url":"https://avatars.githubusercontent.com/u/1330400?v=3","gravatar_id":"","url":"https://api.github.com/users/michaelbrooks","html_url":"https://github.com/michaelbrooks","followers_url":"https://api.github.com/users/michaelbrooks/followers","following_url":"https://api.github.com/users/michaelbrooks/following{/other_user}","gists_url":"https://api.github.com/users/michaelbrooks/gists{/gist_id}","starred_url":"https://api.github.com/users/michaelbrooks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaelbrooks/subscriptions","organizations_url":"https://api.github.com/users/michaelbrooks/orgs","repos_url":"https://api.github.com/users/michaelbrooks/repos","events_url":"https://api.github.com/users/michaelbrooks/events{/privacy}","received_events_url":"https://api.github.com/users/michaelbrooks/received_events","type":"User","site_admin":false},"repo":{"id":27850976,"name":"uw-message-coding","full_name":"michaelbrooks/uw-message-coding","owner":{"login":"michaelbrooks","id":1330400,"avatar_url":"https://avatars.githubusercontent.com/u/1330400?v=3","gravatar_id":"","url":"https://api.github.com/users/michaelbrooks","html_url":"https://github.com/michaelbrooks","followers_url":"https://api.github.com/users/michaelbrooks/followers","following_url":"https://api.github.com/users/michaelbrooks/following{/other_user}","gists_url":"https://api.github.com/users/michaelbrooks/gists{/gist_id}","starred_url":"https://api.github.com/users/michaelbrooks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaelbrooks/subscriptions","organizations_url":"https://api.github.com/users/michaelbrooks/orgs","repos_url":"https://api.github.com/users/michaelbrooks/repos","events_url":"https://api.github.com/users/michaelbrooks/events{/privacy}","received_events_url":"https://api.github.com/users/michaelbrooks/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/michaelbrooks/uw-message-coding","description":"Early prototype of a web-based message coding tool.","fork":false,"url":"https://api.github.com/repos/michaelbrooks/uw-message-coding","forks_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/forks","keys_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/keys{/key_id}","collaborators_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/teams","hooks_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/hooks","issue_events_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/issues/events{/number}","events_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/events","assignees_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/assignees{/user}","branches_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/branches{/branch}","tags_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/tags","blobs_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/git/refs{/sha}","trees_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/git/trees{/sha}","statuses_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/statuses/{sha}","languages_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/languages","stargazers_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/stargazers","contributors_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/contributors","subscribers_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/subscribers","subscription_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/subscription","commits_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/commits{/sha}","git_commits_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/git/commits{/sha}","comments_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/comments{/number}","issue_comment_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/issues/comments/{number}","contents_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/contents/{+path}","compare_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/compare/{base}...{head}","merges_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/merges","archive_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/downloads","issues_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/issues{/number}","pulls_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/pulls{/number}","milestones_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/milestones{/number}","notifications_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/labels{/name}","releases_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/releases{/id}","created_at":"2014-12-11T02:48:21Z","updated_at":"2014-12-23T23:56:08Z","pushed_at":"2014-12-27T20:54:52Z","git_url":"git://github.com/michaelbrooks/uw-message-coding.git","ssh_url":"git@github.com:michaelbrooks/uw-message-coding.git","clone_url":"https://github.com/michaelbrooks/uw-message-coding.git","svn_url":"https://github.com/michaelbrooks/uw-message-coding","homepage":null,"size":478,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":11,"forks":1,"open_issues":11,"watchers":1,"default_branch":"master"}},"base":{"label":"michaelbrooks:master","ref":"master","sha":"69f4e739d4c899ef6a2a590fe3e43b293ccc5e52","user":{"login":"michaelbrooks","id":1330400,"avatar_url":"https://avatars.githubusercontent.com/u/1330400?v=3","gravatar_id":"","url":"https://api.github.com/users/michaelbrooks","html_url":"https://github.com/michaelbrooks","followers_url":"https://api.github.com/users/michaelbrooks/followers","following_url":"https://api.github.com/users/michaelbrooks/following{/other_user}","gists_url":"https://api.github.com/users/michaelbrooks/gists{/gist_id}","starred_url":"https://api.github.com/users/michaelbrooks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaelbrooks/subscriptions","organizations_url":"https://api.github.com/users/michaelbrooks/orgs","repos_url":"https://api.github.com/users/michaelbrooks/repos","events_url":"https://api.github.com/users/michaelbrooks/events{/privacy}","received_events_url":"https://api.github.com/users/michaelbrooks/received_events","type":"User","site_admin":false},"repo":{"id":27850976,"name":"uw-message-coding","full_name":"michaelbrooks/uw-message-coding","owner":{"login":"michaelbrooks","id":1330400,"avatar_url":"https://avatars.githubusercontent.com/u/1330400?v=3","gravatar_id":"","url":"https://api.github.com/users/michaelbrooks","html_url":"https://github.com/michaelbrooks","followers_url":"https://api.github.com/users/michaelbrooks/followers","following_url":"https://api.github.com/users/michaelbrooks/following{/other_user}","gists_url":"https://api.github.com/users/michaelbrooks/gists{/gist_id}","starred_url":"https://api.github.com/users/michaelbrooks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaelbrooks/subscriptions","organizations_url":"https://api.github.com/users/michaelbrooks/orgs","repos_url":"https://api.github.com/users/michaelbrooks/repos","events_url":"https://api.github.com/users/michaelbrooks/events{/privacy}","received_events_url":"https://api.github.com/users/michaelbrooks/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/michaelbrooks/uw-message-coding","description":"Early prototype of a web-based message coding tool.","fork":false,"url":"https://api.github.com/repos/michaelbrooks/uw-message-coding","forks_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/forks","keys_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/keys{/key_id}","collaborators_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/teams","hooks_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/hooks","issue_events_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/issues/events{/number}","events_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/events","assignees_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/assignees{/user}","branches_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/branches{/branch}","tags_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/tags","blobs_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/git/refs{/sha}","trees_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/git/trees{/sha}","statuses_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/statuses/{sha}","languages_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/languages","stargazers_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/stargazers","contributors_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/contributors","subscribers_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/subscribers","subscription_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/subscription","commits_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/commits{/sha}","git_commits_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/git/commits{/sha}","comments_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/comments{/number}","issue_comment_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/issues/comments/{number}","contents_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/contents/{+path}","compare_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/compare/{base}...{head}","merges_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/merges","archive_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/downloads","issues_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/issues{/number}","pulls_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/pulls{/number}","milestones_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/milestones{/number}","notifications_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/labels{/name}","releases_url":"https://api.github.com/repos/michaelbrooks/uw-message-coding/releases{/id}","created_at":"2014-12-11T02:48:21Z","updated_at":"2014-12-23T23:56:08Z","pushed_at":"2014-12-27T20:54:52Z","git_url":"git://github.com/michaelbrooks/uw-message-coding.git","ssh_url":"git@github.com:michaelbrooks/uw-message-coding.git","clone_url":"https://github.com/michaelbrooks/uw-message-coding.git","svn_url":"https://github.com/michaelbrooks/uw-message-coding","homepage":null,"size":478,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":11,"forks":1,"open_issues":11,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/michaelbrooks/uw-message-coding/pulls/30"},"html":{"href":"https://github.com/michaelbrooks/uw-message-coding/pull/30"},"issue":{"href":"https://api.github.com/repos/michaelbrooks/uw-message-coding/issues/30"},"comments":{"href":"https://api.github.com/repos/michaelbrooks/uw-message-coding/issues/30/comments"},"review_comments":{"href":"https://api.github.com/repos/michaelbrooks/uw-message-coding/pulls/30/comments"},"review_comment":{"href":"https://api.github.com/repos/michaelbrooks/uw-message-coding/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/michaelbrooks/uw-message-coding/pulls/30/commits"},"statuses":{"href":"https://api.github.com/repos/michaelbrooks/uw-message-coding/statuses/f04f5c1c3480241de4d2ffc27317cc3319d43690"}}}}