{"action":"created","comment":{"url":"https://api.github.com/repos/hydroshare/hydroshare/pulls/comments/30177926","id":30177926,"diff_hunk":"@@ -0,0 +1,550 @@\n+__author__ = 'Mohamed Morsy'\n+from django.contrib.contenttypes import generic\n+from django.contrib.contenttypes.models import ContentType\n+from django.core.exceptions import ValidationError, ObjectDoesNotExist\n+from django.contrib.auth.models import User, Group\n+from django.db import models\n+from mezzanine.pages.models import Page, RichText\n+from mezzanine.core.models import Ownable\n+from mezzanine.pages.page_processors import processor_for\n+from hs_core.models import AbstractResource, resource_processor, CoreMetaData, AbstractMetaDataElement\n+\n+\n+\n+\n+# extended metadata elements for SWAT Model Instance resource type\n+class ModelOutput(AbstractMetaDataElement):\n+    term = 'ModelOutput'\n+    includes_output = models.BooleanField(default=False)\n+\n+    @classmethod\n+    def create(cls, **kwargs):\n+        return ModelOutput.objects.create(**kwargs)\n+\n+    @classmethod\n+    def update(cls, element_id, **kwargs):\n+        model_output = ModelOutput.objects.get(id=element_id)\n+        if model_output:\n+            for key, value in kwargs.iteritems():\n+                setattr(model_output, key, value)\n+\n+            model_output.save()\n+        else:\n+            raise ObjectDoesNotExist(\"No ModelOutput element was found for the provided id:%s\" % kwargs['id'])\n+\n+    @classmethod\n+    def remove(cls, element_id):\n+        raise ValidationError(\"ModelOutput element of a resource can't be deleted.\")\n+\n+\n+class ExecutedBy(AbstractMetaDataElement):\n+    term = 'ExecutedBY'\n+    name = models.CharField(max_length=500)\n+    url = models.URLField()\n+\n+    def __unicode__(self):\n+        self.name\n+\n+    @classmethod\n+    def create(cls, **kwargs):\n+        return ExecutedBy.objects.create(**kwargs)","path":"hs_swat_modelinstance/models.py","position":50,"original_position":50,"commit_id":"87a8744aecd617b4e6cb85d0c04c82de76750f8d","original_commit_id":"87a8744aecd617b4e6cb85d0c04c82de76750f8d","user":{"login":"mohamedmorsy","id":5543781,"avatar_url":"https://avatars.githubusercontent.com/u/5543781?v=3","gravatar_id":"","url":"https://api.github.com/users/mohamedmorsy","html_url":"https://github.com/mohamedmorsy","followers_url":"https://api.github.com/users/mohamedmorsy/followers","following_url":"https://api.github.com/users/mohamedmorsy/following{/other_user}","gists_url":"https://api.github.com/users/mohamedmorsy/gists{/gist_id}","starred_url":"https://api.github.com/users/mohamedmorsy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mohamedmorsy/subscriptions","organizations_url":"https://api.github.com/users/mohamedmorsy/orgs","repos_url":"https://api.github.com/users/mohamedmorsy/repos","events_url":"https://api.github.com/users/mohamedmorsy/events{/privacy}","received_events_url":"https://api.github.com/users/mohamedmorsy/received_events","type":"User","site_admin":false},"body":"Done.","created_at":"2015-05-12T20:42:16Z","updated_at":"2015-05-12T20:42:16Z","html_url":"https://github.com/hydroshare/hydroshare/pull/368#discussion_r30177926","pull_request_url":"https://api.github.com/repos/hydroshare/hydroshare/pulls/368","_links":{"self":{"href":"https://api.github.com/repos/hydroshare/hydroshare/pulls/comments/30177926"},"html":{"href":"https://github.com/hydroshare/hydroshare/pull/368#discussion_r30177926"},"pull_request":{"href":"https://api.github.com/repos/hydroshare/hydroshare/pulls/368"}}},"pull_request":{"url":"https://api.github.com/repos/hydroshare/hydroshare/pulls/368","id":35160331,"html_url":"https://github.com/hydroshare/hydroshare/pull/368","diff_url":"https://github.com/hydroshare/hydroshare/pull/368.diff","patch_url":"https://github.com/hydroshare/hydroshare/pull/368.patch","issue_url":"https://api.github.com/repos/hydroshare/hydroshare/issues/368","number":368,"state":"open","locked":false,"title":"303 swat model instance","user":{"login":"mohamedmorsy","id":5543781,"avatar_url":"https://avatars.githubusercontent.com/u/5543781?v=3","gravatar_id":"","url":"https://api.github.com/users/mohamedmorsy","html_url":"https://github.com/mohamedmorsy","followers_url":"https://api.github.com/users/mohamedmorsy/followers","following_url":"https://api.github.com/users/mohamedmorsy/following{/other_user}","gists_url":"https://api.github.com/users/mohamedmorsy/gists{/gist_id}","starred_url":"https://api.github.com/users/mohamedmorsy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mohamedmorsy/subscriptions","organizations_url":"https://api.github.com/users/mohamedmorsy/orgs","repos_url":"https://api.github.com/users/mohamedmorsy/repos","events_url":"https://api.github.com/users/mohamedmorsy/events{/privacy}","received_events_url":"https://api.github.com/users/mohamedmorsy/received_events","type":"User","site_admin":false},"body":"This is the first phase of implementing SWAT Model Instance resource type. This phase does not include the link between SWAT Model Instance resource type and Model Program resource type.","created_at":"2015-05-11T19:27:52Z","updated_at":"2015-05-12T20:42:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f9bf95564ad6a19b1949200be60945a9d323ff02","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/hydroshare/hydroshare/pulls/368/commits","review_comments_url":"https://api.github.com/repos/hydroshare/hydroshare/pulls/368/comments","review_comment_url":"https://api.github.com/repos/hydroshare/hydroshare/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hydroshare/hydroshare/issues/368/comments","statuses_url":"https://api.github.com/repos/hydroshare/hydroshare/statuses/87a8744aecd617b4e6cb85d0c04c82de76750f8d","head":{"label":"hydroshare:303-SWATModelInstance","ref":"303-SWATModelInstance","sha":"87a8744aecd617b4e6cb85d0c04c82de76750f8d","user":{"login":"hydroshare","id":3444493,"avatar_url":"https://avatars.githubusercontent.com/u/3444493?v=3","gravatar_id":"","url":"https://api.github.com/users/hydroshare","html_url":"https://github.com/hydroshare","followers_url":"https://api.github.com/users/hydroshare/followers","following_url":"https://api.github.com/users/hydroshare/following{/other_user}","gists_url":"https://api.github.com/users/hydroshare/gists{/gist_id}","starred_url":"https://api.github.com/users/hydroshare/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hydroshare/subscriptions","organizations_url":"https://api.github.com/users/hydroshare/orgs","repos_url":"https://api.github.com/users/hydroshare/repos","events_url":"https://api.github.com/users/hydroshare/events{/privacy}","received_events_url":"https://api.github.com/users/hydroshare/received_events","type":"Organization","site_admin":false},"repo":{"id":24703136,"name":"hydroshare","full_name":"hydroshare/hydroshare","owner":{"login":"hydroshare","id":3444493,"avatar_url":"https://avatars.githubusercontent.com/u/3444493?v=3","gravatar_id":"","url":"https://api.github.com/users/hydroshare","html_url":"https://github.com/hydroshare","followers_url":"https://api.github.com/users/hydroshare/followers","following_url":"https://api.github.com/users/hydroshare/following{/other_user}","gists_url":"https://api.github.com/users/hydroshare/gists{/gist_id}","starred_url":"https://api.github.com/users/hydroshare/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hydroshare/subscriptions","organizations_url":"https://api.github.com/users/hydroshare/orgs","repos_url":"https://api.github.com/users/hydroshare/repos","events_url":"https://api.github.com/users/hydroshare/events{/privacy}","received_events_url":"https://api.github.com/users/hydroshare/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hydroshare/hydroshare","description":"HydroShare is a collaborative website being developed for better access to data and models in the hydrologic sciences. ","fork":false,"url":"https://api.github.com/repos/hydroshare/hydroshare","forks_url":"https://api.github.com/repos/hydroshare/hydroshare/forks","keys_url":"https://api.github.com/repos/hydroshare/hydroshare/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hydroshare/hydroshare/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hydroshare/hydroshare/teams","hooks_url":"https://api.github.com/repos/hydroshare/hydroshare/hooks","issue_events_url":"https://api.github.com/repos/hydroshare/hydroshare/issues/events{/number}","events_url":"https://api.github.com/repos/hydroshare/hydroshare/events","assignees_url":"https://api.github.com/repos/hydroshare/hydroshare/assignees{/user}","branches_url":"https://api.github.com/repos/hydroshare/hydroshare/branches{/branch}","tags_url":"https://api.github.com/repos/hydroshare/hydroshare/tags","blobs_url":"https://api.github.com/repos/hydroshare/hydroshare/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hydroshare/hydroshare/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hydroshare/hydroshare/git/refs{/sha}","trees_url":"https://api.github.com/repos/hydroshare/hydroshare/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hydroshare/hydroshare/statuses/{sha}","languages_url":"https://api.github.com/repos/hydroshare/hydroshare/languages","stargazers_url":"https://api.github.com/repos/hydroshare/hydroshare/stargazers","contributors_url":"https://api.github.com/repos/hydroshare/hydroshare/contributors","subscribers_url":"https://api.github.com/repos/hydroshare/hydroshare/subscribers","subscription_url":"https://api.github.com/repos/hydroshare/hydroshare/subscription","commits_url":"https://api.github.com/repos/hydroshare/hydroshare/commits{/sha}","git_commits_url":"https://api.github.com/repos/hydroshare/hydroshare/git/commits{/sha}","comments_url":"https://api.github.com/repos/hydroshare/hydroshare/comments{/number}","issue_comment_url":"https://api.github.com/repos/hydroshare/hydroshare/issues/comments{/number}","contents_url":"https://api.github.com/repos/hydroshare/hydroshare/contents/{+path}","compare_url":"https://api.github.com/repos/hydroshare/hydroshare/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hydroshare/hydroshare/merges","archive_url":"https://api.github.com/repos/hydroshare/hydroshare/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hydroshare/hydroshare/downloads","issues_url":"https://api.github.com/repos/hydroshare/hydroshare/issues{/number}","pulls_url":"https://api.github.com/repos/hydroshare/hydroshare/pulls{/number}","milestones_url":"https://api.github.com/repos/hydroshare/hydroshare/milestones{/number}","notifications_url":"https://api.github.com/repos/hydroshare/hydroshare/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hydroshare/hydroshare/labels{/name}","releases_url":"https://api.github.com/repos/hydroshare/hydroshare/releases{/id}","created_at":"2014-10-02T02:19:41Z","updated_at":"2015-04-01T15:17:27Z","pushed_at":"2015-05-12T20:40:24Z","git_url":"git://github.com/hydroshare/hydroshare.git","ssh_url":"git@github.com:hydroshare/hydroshare.git","clone_url":"https://github.com/hydroshare/hydroshare.git","svn_url":"https://github.com/hydroshare/hydroshare","homepage":"https://www.cuahsi.org/hydroshare","size":62457,"stargazers_count":9,"watchers_count":9,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":130,"forks":1,"open_issues":130,"watchers":9,"default_branch":"master"}},"base":{"label":"hydroshare:develop","ref":"develop","sha":"977c2014c97ccdd9ba823e23a5a47e831bfa0b96","user":{"login":"hydroshare","id":3444493,"avatar_url":"https://avatars.githubusercontent.com/u/3444493?v=3","gravatar_id":"","url":"https://api.github.com/users/hydroshare","html_url":"https://github.com/hydroshare","followers_url":"https://api.github.com/users/hydroshare/followers","following_url":"https://api.github.com/users/hydroshare/following{/other_user}","gists_url":"https://api.github.com/users/hydroshare/gists{/gist_id}","starred_url":"https://api.github.com/users/hydroshare/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hydroshare/subscriptions","organizations_url":"https://api.github.com/users/hydroshare/orgs","repos_url":"https://api.github.com/users/hydroshare/repos","events_url":"https://api.github.com/users/hydroshare/events{/privacy}","received_events_url":"https://api.github.com/users/hydroshare/received_events","type":"Organization","site_admin":false},"repo":{"id":24703136,"name":"hydroshare","full_name":"hydroshare/hydroshare","owner":{"login":"hydroshare","id":3444493,"avatar_url":"https://avatars.githubusercontent.com/u/3444493?v=3","gravatar_id":"","url":"https://api.github.com/users/hydroshare","html_url":"https://github.com/hydroshare","followers_url":"https://api.github.com/users/hydroshare/followers","following_url":"https://api.github.com/users/hydroshare/following{/other_user}","gists_url":"https://api.github.com/users/hydroshare/gists{/gist_id}","starred_url":"https://api.github.com/users/hydroshare/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hydroshare/subscriptions","organizations_url":"https://api.github.com/users/hydroshare/orgs","repos_url":"https://api.github.com/users/hydroshare/repos","events_url":"https://api.github.com/users/hydroshare/events{/privacy}","received_events_url":"https://api.github.com/users/hydroshare/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hydroshare/hydroshare","description":"HydroShare is a collaborative website being developed for better access to data and models in the hydrologic sciences. ","fork":false,"url":"https://api.github.com/repos/hydroshare/hydroshare","forks_url":"https://api.github.com/repos/hydroshare/hydroshare/forks","keys_url":"https://api.github.com/repos/hydroshare/hydroshare/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hydroshare/hydroshare/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hydroshare/hydroshare/teams","hooks_url":"https://api.github.com/repos/hydroshare/hydroshare/hooks","issue_events_url":"https://api.github.com/repos/hydroshare/hydroshare/issues/events{/number}","events_url":"https://api.github.com/repos/hydroshare/hydroshare/events","assignees_url":"https://api.github.com/repos/hydroshare/hydroshare/assignees{/user}","branches_url":"https://api.github.com/repos/hydroshare/hydroshare/branches{/branch}","tags_url":"https://api.github.com/repos/hydroshare/hydroshare/tags","blobs_url":"https://api.github.com/repos/hydroshare/hydroshare/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hydroshare/hydroshare/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hydroshare/hydroshare/git/refs{/sha}","trees_url":"https://api.github.com/repos/hydroshare/hydroshare/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hydroshare/hydroshare/statuses/{sha}","languages_url":"https://api.github.com/repos/hydroshare/hydroshare/languages","stargazers_url":"https://api.github.com/repos/hydroshare/hydroshare/stargazers","contributors_url":"https://api.github.com/repos/hydroshare/hydroshare/contributors","subscribers_url":"https://api.github.com/repos/hydroshare/hydroshare/subscribers","subscription_url":"https://api.github.com/repos/hydroshare/hydroshare/subscription","commits_url":"https://api.github.com/repos/hydroshare/hydroshare/commits{/sha}","git_commits_url":"https://api.github.com/repos/hydroshare/hydroshare/git/commits{/sha}","comments_url":"https://api.github.com/repos/hydroshare/hydroshare/comments{/number}","issue_comment_url":"https://api.github.com/repos/hydroshare/hydroshare/issues/comments{/number}","contents_url":"https://api.github.com/repos/hydroshare/hydroshare/contents/{+path}","compare_url":"https://api.github.com/repos/hydroshare/hydroshare/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hydroshare/hydroshare/merges","archive_url":"https://api.github.com/repos/hydroshare/hydroshare/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hydroshare/hydroshare/downloads","issues_url":"https://api.github.com/repos/hydroshare/hydroshare/issues{/number}","pulls_url":"https://api.github.com/repos/hydroshare/hydroshare/pulls{/number}","milestones_url":"https://api.github.com/repos/hydroshare/hydroshare/milestones{/number}","notifications_url":"https://api.github.com/repos/hydroshare/hydroshare/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hydroshare/hydroshare/labels{/name}","releases_url":"https://api.github.com/repos/hydroshare/hydroshare/releases{/id}","created_at":"2014-10-02T02:19:41Z","updated_at":"2015-04-01T15:17:27Z","pushed_at":"2015-05-12T20:40:24Z","git_url":"git://github.com/hydroshare/hydroshare.git","ssh_url":"git@github.com:hydroshare/hydroshare.git","clone_url":"https://github.com/hydroshare/hydroshare.git","svn_url":"https://github.com/hydroshare/hydroshare","homepage":"https://www.cuahsi.org/hydroshare","size":62457,"stargazers_count":9,"watchers_count":9,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":130,"forks":1,"open_issues":130,"watchers":9,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hydroshare/hydroshare/pulls/368"},"html":{"href":"https://github.com/hydroshare/hydroshare/pull/368"},"issue":{"href":"https://api.github.com/repos/hydroshare/hydroshare/issues/368"},"comments":{"href":"https://api.github.com/repos/hydroshare/hydroshare/issues/368/comments"},"review_comments":{"href":"https://api.github.com/repos/hydroshare/hydroshare/pulls/368/comments"},"review_comment":{"href":"https://api.github.com/repos/hydroshare/hydroshare/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hydroshare/hydroshare/pulls/368/commits"},"statuses":{"href":"https://api.github.com/repos/hydroshare/hydroshare/statuses/87a8744aecd617b4e6cb85d0c04c82de76750f8d"}}}}