{"action":"created","comment":{"url":"https://api.github.com/repos/Cadasta/cadasta-platform/pulls/comments/77992815","id":77992815,"diff_hunk":"@@ -225,6 +226,24 @@ def __str__(self):\n     def __repr__(self):\n         return str(self)\n \n+    @property\n+    def ui_object_name(self):\n+        return self.name\n+\n+    @property\n+    def ui_class_name(self):","path":"cadasta/organization/models.py","position":14,"original_position":14,"commit_id":"518c7d547e18b7660f6e46f573a508dfc1c10562","original_commit_id":"518c7d547e18b7660f6e46f573a508dfc1c10562","user":{"login":"seav","id":873653,"avatar_url":"https://avatars.githubusercontent.com/u/873653?v=3","gravatar_id":"","url":"https://api.github.com/users/seav","html_url":"https://github.com/seav","followers_url":"https://api.github.com/users/seav/followers","following_url":"https://api.github.com/users/seav/following{/other_user}","gists_url":"https://api.github.com/users/seav/gists{/gist_id}","starred_url":"https://api.github.com/users/seav/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/seav/subscriptions","organizations_url":"https://api.github.com/users/seav/orgs","repos_url":"https://api.github.com/users/seav/repos","events_url":"https://api.github.com/users/seav/events{/privacy}","received_events_url":"https://api.github.com/users/seav/received_events","type":"User","site_admin":false},"body":"OK, will do. Same for other similar comments below.","created_at":"2016-09-08T12:05:44Z","updated_at":"2016-09-08T12:05:44Z","html_url":"https://github.com/Cadasta/cadasta-platform/pull/644#discussion_r77992815","pull_request_url":"https://api.github.com/repos/Cadasta/cadasta-platform/pulls/644","_links":{"self":{"href":"https://api.github.com/repos/Cadasta/cadasta-platform/pulls/comments/77992815"},"html":{"href":"https://github.com/Cadasta/cadasta-platform/pull/644#discussion_r77992815"},"pull_request":{"href":"https://api.github.com/repos/Cadasta/cadasta-platform/pulls/644"}}},"pull_request":{"url":"https://api.github.com/repos/Cadasta/cadasta-platform/pulls/644","id":84027069,"html_url":"https://github.com/Cadasta/cadasta-platform/pull/644","diff_url":"https://github.com/Cadasta/cadasta-platform/pull/644.diff","patch_url":"https://github.com/Cadasta/cadasta-platform/pull/644.patch","issue_url":"https://api.github.com/repos/Cadasta/cadasta-platform/issues/644","number":644,"state":"open","locked":false,"title":"Resolve #261 and #497: Improve handling of resources","user":{"login":"seav","id":873653,"avatar_url":"https://avatars.githubusercontent.com/u/873653?v=3","gravatar_id":"","url":"https://api.github.com/users/seav","html_url":"https://github.com/seav","followers_url":"https://api.github.com/users/seav/followers","following_url":"https://api.github.com/users/seav/following{/other_user}","gists_url":"https://api.github.com/users/seav/gists{/gist_id}","starred_url":"https://api.github.com/users/seav/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/seav/subscriptions","organizations_url":"https://api.github.com/users/seav/orgs","repos_url":"https://api.github.com/users/seav/repos","events_url":"https://api.github.com/users/seav/events{/privacy}","received_events_url":"https://api.github.com/users/seav/received_events","type":"User","site_admin":false},"body":"### Proposed changes in this pull request\r\n- Resolve #261:\r\n    - For the background, please see the discussion in #261.\r\n    - **TL;DR:** Make attaching and detaching of resources more usable by only providing the attach function with the “Attach” button and introducing “Detach” buttons in appropriate places. Also, treat archived resources as if they were deleted (and completely detached from everything) with only superusers having the power to restore them (but with no reattachment).\r\n    - Use terms like “attach”, “detach”, “unattached”, “attached to”, and “attachments” instead of “add”, “remove”, and “connections”. This mainly affects templates and the `ResourceWidget`.\r\n        - Update `ResourceWidget` unit tests.\r\n    - Make the “Attach” button only about attaching resources:\r\n        - *Current behavior:* When showing the form to attach resources from the library, all resources are listed and already attached ones are checked, so the user could attach and detach as desired. This is not really intuitive to the user.\r\n        - *Proposed behavior:* Change the attach resource list to only show resources that are unattached to the current entity. If all resources are already attached, the user is never shown the resource library and is instead directed to upload a new resource.\r\n        - Replace `ProjectHasResourcesMixin` with `HasUnattachedResourcesMixin` to implement this proposed behavior.\r\n        - Update `AddResourceFromLibraryForm` to only show unattached resources and to remove the detaching function.\r\n        - Update unit tests to reflect this proposed implementation.\r\n    - Provide explicit detach functionality in the UI:\r\n        - *Proposed behavior part 1:* In the 4 types of pages that show a table of attached resources (for projects, locations, parties, and relationships), add an action column with a “Detach” button for each resource row to detach the resource from the current object. Update the project resources list to show the whole project resource library and only show the “Detach” button to resources attached to the project itself.\r\n        - *Proposed behavior part 2:* In the resource detail page, if the resource is not archived, add a table showing the objects to which the resource is attached. This table contains a column with a “Detach” button for each object row to detach the resource from the corresponding object.\r\n        - Add the `^resources/(?P<resource>[-\\w]+)/detach/(?P<attachment>[-\\w]+)/$` URL pattern to allow detaching resources by referring to its `ContentObject.id` as `P<attachment>`.\r\n        - Add the `ResourceDetach` generic `DeleteView` class for the above URL pattern. This view deletes the `ContentObject` corresponding to the resource-object attachment to be deleted.\r\n        - Add the `DetachableResourcesListMixin`. This mixin replaces the current `get_object().resources` list with an enhanced resources list that includes the `ContentObject.id` so that links to the URL pattern above can be easily constructed.\r\n        - Update `ProjectResourcesDetail` view and its template to construct a list of objects the resources is attached to. The view contains new code to check for the 4 possible objects resources can be attached to.\r\n        - Update views and templates to include the aforementioned “Detach” buttons, by making use of the `DetachableResourcesListMixin`.\r\n        - Add unit tests under the `ResourceDetachTest` class.\r\n        - Update other unit tests, especially the `ProjectResourcesDetailTest` class to test the new code mentioned above for the `ProjectResourcesDetail` class.\r\n    - Treat archived resources as if they were deleted:\r\n        - *Proposed behavior part 1:* Use “delete” and “restore” terms instead of “archive” and “unarchive” in the UI. Only show archived resources and buttons to restore them to the superuser and provide \"Deleted\" labels to the superuser in the resource detail page, and the project resources page to indicate archived resources. Provide “Restore” buttons on the project resources page so that the superuser can restore resources with 1 less step (no need to go to the resource detail page).\r\n        - *Proposed behavior part 2:* When a resource is archived, it is detached from all objects it is attached to.\r\n        - Update views (especially `ResourceViewMixin`) and templates to reflect the proposed UI change part 1 mentioned above.\r\n        - Split out the delete and restore confirmation modals from the resource detail template so that the latter modal can be reused in the project resources page. Add JavaScript and modal template plumbing code so that this reused modal can apply to any deleted resource in the project resources page.\r\n        - Update `AddResourceFromLibraryForm` to only show unarchived resources.\r\n        - Update the `archive_file()` pre-save signal receiver of the resource model to delete any associated `ContentObject` instances.\r\n        - Update and add unit tests especially to check non-superuser vs. superuser behavior for archiving and unarchiving resources.\r\n- Resolve #497:\r\n    - Made the columns of all resource tables as consistent as possible. This is a side-effect of resolving #261 above.\r\n- Partially resolve #533 (“Display user's friendly file name for resources”):\r\n    - Update `ResourceWidget` and templates to show `original_file` instead of `file_name`.\r\n    - Update widget unit test to match.\r\n    - *Note:* The full resolution of #497 should be done in django-buckets.\r\n- Other improvements:\r\n    - Correct wrong spelling of `orginial` with `original` and `exisiting` with `existing`.\r\n\r\n### When should this PR be merged\r\nBefore merding, a good review of the backend code would be really swell as many things have changed.\r\n\r\n### Risks\r\nNo risks foreseen.\r\n\r\n### Follow up actions\r\nNone.\r\n","created_at":"2016-09-05T17:12:22Z","updated_at":"2016-09-08T12:05:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"39a964a17a60ba2b4a39c9110f453ec60e5ffa4e","assignee":{"login":"oliverroick","id":159510,"avatar_url":"https://avatars.githubusercontent.com/u/159510?v=3","gravatar_id":"","url":"https://api.github.com/users/oliverroick","html_url":"https://github.com/oliverroick","followers_url":"https://api.github.com/users/oliverroick/followers","following_url":"https://api.github.com/users/oliverroick/following{/other_user}","gists_url":"https://api.github.com/users/oliverroick/gists{/gist_id}","starred_url":"https://api.github.com/users/oliverroick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oliverroick/subscriptions","organizations_url":"https://api.github.com/users/oliverroick/orgs","repos_url":"https://api.github.com/users/oliverroick/repos","events_url":"https://api.github.com/users/oliverroick/events{/privacy}","received_events_url":"https://api.github.com/users/oliverroick/received_events","type":"User","site_admin":false},"assignees":[{"login":"oliverroick","id":159510,"avatar_url":"https://avatars.githubusercontent.com/u/159510?v=3","gravatar_id":"","url":"https://api.github.com/users/oliverroick","html_url":"https://github.com/oliverroick","followers_url":"https://api.github.com/users/oliverroick/followers","following_url":"https://api.github.com/users/oliverroick/following{/other_user}","gists_url":"https://api.github.com/users/oliverroick/gists{/gist_id}","starred_url":"https://api.github.com/users/oliverroick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oliverroick/subscriptions","organizations_url":"https://api.github.com/users/oliverroick/orgs","repos_url":"https://api.github.com/users/oliverroick/repos","events_url":"https://api.github.com/users/oliverroick/events{/privacy}","received_events_url":"https://api.github.com/users/oliverroick/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/Cadasta/cadasta-platform/pulls/644/commits","review_comments_url":"https://api.github.com/repos/Cadasta/cadasta-platform/pulls/644/comments","review_comment_url":"https://api.github.com/repos/Cadasta/cadasta-platform/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Cadasta/cadasta-platform/issues/644/comments","statuses_url":"https://api.github.com/repos/Cadasta/cadasta-platform/statuses/518c7d547e18b7660f6e46f573a508dfc1c10562","head":{"label":"Cadasta:enhancement/#261","ref":"enhancement/#261","sha":"518c7d547e18b7660f6e46f573a508dfc1c10562","user":{"login":"Cadasta","id":11321107,"avatar_url":"https://avatars.githubusercontent.com/u/11321107?v=3","gravatar_id":"","url":"https://api.github.com/users/Cadasta","html_url":"https://github.com/Cadasta","followers_url":"https://api.github.com/users/Cadasta/followers","following_url":"https://api.github.com/users/Cadasta/following{/other_user}","gists_url":"https://api.github.com/users/Cadasta/gists{/gist_id}","starred_url":"https://api.github.com/users/Cadasta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Cadasta/subscriptions","organizations_url":"https://api.github.com/users/Cadasta/orgs","repos_url":"https://api.github.com/users/Cadasta/repos","events_url":"https://api.github.com/users/Cadasta/events{/privacy}","received_events_url":"https://api.github.com/users/Cadasta/received_events","type":"Organization","site_admin":false},"repo":{"id":45993428,"name":"cadasta-platform","full_name":"Cadasta/cadasta-platform","owner":{"login":"Cadasta","id":11321107,"avatar_url":"https://avatars.githubusercontent.com/u/11321107?v=3","gravatar_id":"","url":"https://api.github.com/users/Cadasta","html_url":"https://github.com/Cadasta","followers_url":"https://api.github.com/users/Cadasta/followers","following_url":"https://api.github.com/users/Cadasta/following{/other_user}","gists_url":"https://api.github.com/users/Cadasta/gists{/gist_id}","starred_url":"https://api.github.com/users/Cadasta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Cadasta/subscriptions","organizations_url":"https://api.github.com/users/Cadasta/orgs","repos_url":"https://api.github.com/users/Cadasta/repos","events_url":"https://api.github.com/users/Cadasta/events{/privacy}","received_events_url":"https://api.github.com/users/Cadasta/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Cadasta/cadasta-platform","description":null,"fork":false,"url":"https://api.github.com/repos/Cadasta/cadasta-platform","forks_url":"https://api.github.com/repos/Cadasta/cadasta-platform/forks","keys_url":"https://api.github.com/repos/Cadasta/cadasta-platform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Cadasta/cadasta-platform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Cadasta/cadasta-platform/teams","hooks_url":"https://api.github.com/repos/Cadasta/cadasta-platform/hooks","issue_events_url":"https://api.github.com/repos/Cadasta/cadasta-platform/issues/events{/number}","events_url":"https://api.github.com/repos/Cadasta/cadasta-platform/events","assignees_url":"https://api.github.com/repos/Cadasta/cadasta-platform/assignees{/user}","branches_url":"https://api.github.com/repos/Cadasta/cadasta-platform/branches{/branch}","tags_url":"https://api.github.com/repos/Cadasta/cadasta-platform/tags","blobs_url":"https://api.github.com/repos/Cadasta/cadasta-platform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Cadasta/cadasta-platform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Cadasta/cadasta-platform/git/refs{/sha}","trees_url":"https://api.github.com/repos/Cadasta/cadasta-platform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Cadasta/cadasta-platform/statuses/{sha}","languages_url":"https://api.github.com/repos/Cadasta/cadasta-platform/languages","stargazers_url":"https://api.github.com/repos/Cadasta/cadasta-platform/stargazers","contributors_url":"https://api.github.com/repos/Cadasta/cadasta-platform/contributors","subscribers_url":"https://api.github.com/repos/Cadasta/cadasta-platform/subscribers","subscription_url":"https://api.github.com/repos/Cadasta/cadasta-platform/subscription","commits_url":"https://api.github.com/repos/Cadasta/cadasta-platform/commits{/sha}","git_commits_url":"https://api.github.com/repos/Cadasta/cadasta-platform/git/commits{/sha}","comments_url":"https://api.github.com/repos/Cadasta/cadasta-platform/comments{/number}","issue_comment_url":"https://api.github.com/repos/Cadasta/cadasta-platform/issues/comments{/number}","contents_url":"https://api.github.com/repos/Cadasta/cadasta-platform/contents/{+path}","compare_url":"https://api.github.com/repos/Cadasta/cadasta-platform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Cadasta/cadasta-platform/merges","archive_url":"https://api.github.com/repos/Cadasta/cadasta-platform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Cadasta/cadasta-platform/downloads","issues_url":"https://api.github.com/repos/Cadasta/cadasta-platform/issues{/number}","pulls_url":"https://api.github.com/repos/Cadasta/cadasta-platform/pulls{/number}","milestones_url":"https://api.github.com/repos/Cadasta/cadasta-platform/milestones{/number}","notifications_url":"https://api.github.com/repos/Cadasta/cadasta-platform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Cadasta/cadasta-platform/labels{/name}","releases_url":"https://api.github.com/repos/Cadasta/cadasta-platform/releases{/id}","deployments_url":"https://api.github.com/repos/Cadasta/cadasta-platform/deployments","created_at":"2015-11-11T16:26:25Z","updated_at":"2016-09-04T11:29:11Z","pushed_at":"2016-09-08T11:40:04Z","git_url":"git://github.com/Cadasta/cadasta-platform.git","ssh_url":"git@github.com:Cadasta/cadasta-platform.git","clone_url":"https://github.com/Cadasta/cadasta-platform.git","svn_url":"https://github.com/Cadasta/cadasta-platform","homepage":null,"size":4290,"stargazers_count":9,"watchers_count":9,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":120,"forks":1,"open_issues":120,"watchers":9,"default_branch":"master"}},"base":{"label":"Cadasta:master","ref":"master","sha":"47efe6a9f91c61c1eb6fac0158aa4512508cb1fd","user":{"login":"Cadasta","id":11321107,"avatar_url":"https://avatars.githubusercontent.com/u/11321107?v=3","gravatar_id":"","url":"https://api.github.com/users/Cadasta","html_url":"https://github.com/Cadasta","followers_url":"https://api.github.com/users/Cadasta/followers","following_url":"https://api.github.com/users/Cadasta/following{/other_user}","gists_url":"https://api.github.com/users/Cadasta/gists{/gist_id}","starred_url":"https://api.github.com/users/Cadasta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Cadasta/subscriptions","organizations_url":"https://api.github.com/users/Cadasta/orgs","repos_url":"https://api.github.com/users/Cadasta/repos","events_url":"https://api.github.com/users/Cadasta/events{/privacy}","received_events_url":"https://api.github.com/users/Cadasta/received_events","type":"Organization","site_admin":false},"repo":{"id":45993428,"name":"cadasta-platform","full_name":"Cadasta/cadasta-platform","owner":{"login":"Cadasta","id":11321107,"avatar_url":"https://avatars.githubusercontent.com/u/11321107?v=3","gravatar_id":"","url":"https://api.github.com/users/Cadasta","html_url":"https://github.com/Cadasta","followers_url":"https://api.github.com/users/Cadasta/followers","following_url":"https://api.github.com/users/Cadasta/following{/other_user}","gists_url":"https://api.github.com/users/Cadasta/gists{/gist_id}","starred_url":"https://api.github.com/users/Cadasta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Cadasta/subscriptions","organizations_url":"https://api.github.com/users/Cadasta/orgs","repos_url":"https://api.github.com/users/Cadasta/repos","events_url":"https://api.github.com/users/Cadasta/events{/privacy}","received_events_url":"https://api.github.com/users/Cadasta/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Cadasta/cadasta-platform","description":null,"fork":false,"url":"https://api.github.com/repos/Cadasta/cadasta-platform","forks_url":"https://api.github.com/repos/Cadasta/cadasta-platform/forks","keys_url":"https://api.github.com/repos/Cadasta/cadasta-platform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Cadasta/cadasta-platform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Cadasta/cadasta-platform/teams","hooks_url":"https://api.github.com/repos/Cadasta/cadasta-platform/hooks","issue_events_url":"https://api.github.com/repos/Cadasta/cadasta-platform/issues/events{/number}","events_url":"https://api.github.com/repos/Cadasta/cadasta-platform/events","assignees_url":"https://api.github.com/repos/Cadasta/cadasta-platform/assignees{/user}","branches_url":"https://api.github.com/repos/Cadasta/cadasta-platform/branches{/branch}","tags_url":"https://api.github.com/repos/Cadasta/cadasta-platform/tags","blobs_url":"https://api.github.com/repos/Cadasta/cadasta-platform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Cadasta/cadasta-platform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Cadasta/cadasta-platform/git/refs{/sha}","trees_url":"https://api.github.com/repos/Cadasta/cadasta-platform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Cadasta/cadasta-platform/statuses/{sha}","languages_url":"https://api.github.com/repos/Cadasta/cadasta-platform/languages","stargazers_url":"https://api.github.com/repos/Cadasta/cadasta-platform/stargazers","contributors_url":"https://api.github.com/repos/Cadasta/cadasta-platform/contributors","subscribers_url":"https://api.github.com/repos/Cadasta/cadasta-platform/subscribers","subscription_url":"https://api.github.com/repos/Cadasta/cadasta-platform/subscription","commits_url":"https://api.github.com/repos/Cadasta/cadasta-platform/commits{/sha}","git_commits_url":"https://api.github.com/repos/Cadasta/cadasta-platform/git/commits{/sha}","comments_url":"https://api.github.com/repos/Cadasta/cadasta-platform/comments{/number}","issue_comment_url":"https://api.github.com/repos/Cadasta/cadasta-platform/issues/comments{/number}","contents_url":"https://api.github.com/repos/Cadasta/cadasta-platform/contents/{+path}","compare_url":"https://api.github.com/repos/Cadasta/cadasta-platform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Cadasta/cadasta-platform/merges","archive_url":"https://api.github.com/repos/Cadasta/cadasta-platform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Cadasta/cadasta-platform/downloads","issues_url":"https://api.github.com/repos/Cadasta/cadasta-platform/issues{/number}","pulls_url":"https://api.github.com/repos/Cadasta/cadasta-platform/pulls{/number}","milestones_url":"https://api.github.com/repos/Cadasta/cadasta-platform/milestones{/number}","notifications_url":"https://api.github.com/repos/Cadasta/cadasta-platform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Cadasta/cadasta-platform/labels{/name}","releases_url":"https://api.github.com/repos/Cadasta/cadasta-platform/releases{/id}","deployments_url":"https://api.github.com/repos/Cadasta/cadasta-platform/deployments","created_at":"2015-11-11T16:26:25Z","updated_at":"2016-09-04T11:29:11Z","pushed_at":"2016-09-08T11:40:04Z","git_url":"git://github.com/Cadasta/cadasta-platform.git","ssh_url":"git@github.com:Cadasta/cadasta-platform.git","clone_url":"https://github.com/Cadasta/cadasta-platform.git","svn_url":"https://github.com/Cadasta/cadasta-platform","homepage":null,"size":4290,"stargazers_count":9,"watchers_count":9,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":120,"forks":1,"open_issues":120,"watchers":9,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Cadasta/cadasta-platform/pulls/644"},"html":{"href":"https://github.com/Cadasta/cadasta-platform/pull/644"},"issue":{"href":"https://api.github.com/repos/Cadasta/cadasta-platform/issues/644"},"comments":{"href":"https://api.github.com/repos/Cadasta/cadasta-platform/issues/644/comments"},"review_comments":{"href":"https://api.github.com/repos/Cadasta/cadasta-platform/pulls/644/comments"},"review_comment":{"href":"https://api.github.com/repos/Cadasta/cadasta-platform/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Cadasta/cadasta-platform/pulls/644/commits"},"statuses":{"href":"https://api.github.com/repos/Cadasta/cadasta-platform/statuses/518c7d547e18b7660f6e46f573a508dfc1c10562"}}}}
{"actor":{"display_login":"seav"}}