{"action":"created","comment":{"url":"https://api.github.com/repos/GeoNode/geonode/pulls/comments/23520295","id":23520295,"diff_hunk":"@@ -87,6 +87,42 @@ class Meta:\n         }\n \n \n+class RegionResource(TypeFilteredResource):\n+\n+    \"\"\"Regions api\"\"\"\n+\n+    def dehydrate_count(self, bundle):\n+        count = 0\n+        if settings.SKIP_PERMS_FILTER:\n+            resources = ResourceBase.published.all()\n+        else:\n+            resources = get_objects_for_user(\n+                bundle.request.user,\n+                'base.view_resourcebase'\n+            )\n+        if settings.RESOURCE_PUBLISHING:\n+            resources = resources.filter(is_published=True)\n+\n+        resources_ids = resources.values_list('id', flat=True)\n+\n+        if self.type_filter:\n+            ctype = ContentType.objects.get_for_model(self.type_filter)\n+            count = bundle.obj.taggit_taggeditem_items.filter(\n+                content_type=ctype).filter(object_id__in=resources_ids).count()\n+        else:\n+            count = bundle.obj.taggit_taggeditem_items.filter(object_id__in=resources_ids).count()\n+\n+        return count\n+\n+    class Meta:\n+        queryset = Tag.objects.all().order_by('name')","path":"geonode/api/api.py","position":43,"original_position":43,"commit_id":"36fcb3710a0640fc83288c4e4ffcc6f9571b95c0","original_commit_id":"36fcb3710a0640fc83288c4e4ffcc6f9571b95c0","user":{"login":"simod","id":779380,"avatar_url":"https://avatars.githubusercontent.com/u/779380?v=3","gravatar_id":"","url":"https://api.github.com/users/simod","html_url":"https://github.com/simod","followers_url":"https://api.github.com/users/simod/followers","following_url":"https://api.github.com/users/simod/following{/other_user}","gists_url":"https://api.github.com/users/simod/gists{/gist_id}","starred_url":"https://api.github.com/users/simod/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simod/subscriptions","organizations_url":"https://api.github.com/users/simod/orgs","repos_url":"https://api.github.com/users/simod/repos","events_url":"https://api.github.com/users/simod/events{/privacy}","received_events_url":"https://api.github.com/users/simod/received_events","type":"User","site_admin":false},"body":"why it's using the Tag as models? Shouldn't be Region?","created_at":"2015-01-26T10:02:41Z","updated_at":"2015-01-26T10:02:41Z","html_url":"https://github.com/GeoNode/geonode/pull/1943#discussion_r23520295","pull_request_url":"https://api.github.com/repos/GeoNode/geonode/pulls/1943","_links":{"self":{"href":"https://api.github.com/repos/GeoNode/geonode/pulls/comments/23520295"},"html":{"href":"https://github.com/GeoNode/geonode/pull/1943#discussion_r23520295"},"pull_request":{"href":"https://api.github.com/repos/GeoNode/geonode/pulls/1943"}}},"pull_request":{"url":"https://api.github.com/repos/GeoNode/geonode/pulls/1943","id":27972103,"html_url":"https://github.com/GeoNode/geonode/pull/1943","diff_url":"https://github.com/GeoNode/geonode/pull/1943.diff","patch_url":"https://github.com/GeoNode/geonode/pull/1943.patch","issue_url":"https://api.github.com/repos/GeoNode/geonode/issues/1943","number":1943,"state":"open","locked":false,"title":"HOLD: Region Filter","user":{"login":"state-hiu","id":2079497,"avatar_url":"https://avatars.githubusercontent.com/u/2079497?v=3","gravatar_id":"","url":"https://api.github.com/users/state-hiu","html_url":"https://github.com/state-hiu","followers_url":"https://api.github.com/users/state-hiu/followers","following_url":"https://api.github.com/users/state-hiu/following{/other_user}","gists_url":"https://api.github.com/users/state-hiu/gists{/gist_id}","starred_url":"https://api.github.com/users/state-hiu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/state-hiu/subscriptions","organizations_url":"https://api.github.com/users/state-hiu/orgs","repos_url":"https://api.github.com/users/state-hiu/repos","events_url":"https://api.github.com/users/state-hiu/events{/privacy}","received_events_url":"https://api.github.com/users/state-hiu/received_events","type":"User","site_admin":false},"body":"For issue #1826, this PR creates a region filter to be displayed right above the extent filter.  The filter is collapsed by default.  The filter uses an autocomplete field against the full list of regions.\r\n\r\n@simod, any suggestions/issues?\r\n\r\n**Known Issues**\r\n- [ ] The text and region autocomplete inputs both work.  However, when I type into text field the text appears in the other one.  Not sure how this is happening.\r\n\r\n**Future Enhancements**\r\n- [ ] Filter autocomplete list by regions with count > 0\r\n- [ ] Select multiple regions.  Display selections.\r\n- [ ] Leverage region hierarchies for filtering","created_at":"2015-01-24T05:29:35Z","updated_at":"2015-01-26T10:02:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d11a50e3c3dbac81c145ffdd284b9e4e259ec43b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/GeoNode/geonode/pulls/1943/commits","review_comments_url":"https://api.github.com/repos/GeoNode/geonode/pulls/1943/comments","review_comment_url":"https://api.github.com/repos/GeoNode/geonode/pulls/comments/{number}","comments_url":"https://api.github.com/repos/GeoNode/geonode/issues/1943/comments","statuses_url":"https://api.github.com/repos/GeoNode/geonode/statuses/36fcb3710a0640fc83288c4e4ffcc6f9571b95c0","head":{"label":"state-hiu:region_filter","ref":"region_filter","sha":"36fcb3710a0640fc83288c4e4ffcc6f9571b95c0","user":{"login":"state-hiu","id":2079497,"avatar_url":"https://avatars.githubusercontent.com/u/2079497?v=3","gravatar_id":"","url":"https://api.github.com/users/state-hiu","html_url":"https://github.com/state-hiu","followers_url":"https://api.github.com/users/state-hiu/followers","following_url":"https://api.github.com/users/state-hiu/following{/other_user}","gists_url":"https://api.github.com/users/state-hiu/gists{/gist_id}","starred_url":"https://api.github.com/users/state-hiu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/state-hiu/subscriptions","organizations_url":"https://api.github.com/users/state-hiu/orgs","repos_url":"https://api.github.com/users/state-hiu/repos","events_url":"https://api.github.com/users/state-hiu/events{/privacy}","received_events_url":"https://api.github.com/users/state-hiu/received_events","type":"User","site_admin":false},"repo":{"id":12766615,"name":"geonode","full_name":"state-hiu/geonode","owner":{"login":"state-hiu","id":2079497,"avatar_url":"https://avatars.githubusercontent.com/u/2079497?v=3","gravatar_id":"","url":"https://api.github.com/users/state-hiu","html_url":"https://github.com/state-hiu","followers_url":"https://api.github.com/users/state-hiu/followers","following_url":"https://api.github.com/users/state-hiu/following{/other_user}","gists_url":"https://api.github.com/users/state-hiu/gists{/gist_id}","starred_url":"https://api.github.com/users/state-hiu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/state-hiu/subscriptions","organizations_url":"https://api.github.com/users/state-hiu/orgs","repos_url":"https://api.github.com/users/state-hiu/repos","events_url":"https://api.github.com/users/state-hiu/events{/privacy}","received_events_url":"https://api.github.com/users/state-hiu/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/state-hiu/geonode","description":"GeoNode is an open source platform that facilitates the creation, sharing, and collaborative use of geospatial data.","fork":true,"url":"https://api.github.com/repos/state-hiu/geonode","forks_url":"https://api.github.com/repos/state-hiu/geonode/forks","keys_url":"https://api.github.com/repos/state-hiu/geonode/keys{/key_id}","collaborators_url":"https://api.github.com/repos/state-hiu/geonode/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/state-hiu/geonode/teams","hooks_url":"https://api.github.com/repos/state-hiu/geonode/hooks","issue_events_url":"https://api.github.com/repos/state-hiu/geonode/issues/events{/number}","events_url":"https://api.github.com/repos/state-hiu/geonode/events","assignees_url":"https://api.github.com/repos/state-hiu/geonode/assignees{/user}","branches_url":"https://api.github.com/repos/state-hiu/geonode/branches{/branch}","tags_url":"https://api.github.com/repos/state-hiu/geonode/tags","blobs_url":"https://api.github.com/repos/state-hiu/geonode/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/state-hiu/geonode/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/state-hiu/geonode/git/refs{/sha}","trees_url":"https://api.github.com/repos/state-hiu/geonode/git/trees{/sha}","statuses_url":"https://api.github.com/repos/state-hiu/geonode/statuses/{sha}","languages_url":"https://api.github.com/repos/state-hiu/geonode/languages","stargazers_url":"https://api.github.com/repos/state-hiu/geonode/stargazers","contributors_url":"https://api.github.com/repos/state-hiu/geonode/contributors","subscribers_url":"https://api.github.com/repos/state-hiu/geonode/subscribers","subscription_url":"https://api.github.com/repos/state-hiu/geonode/subscription","commits_url":"https://api.github.com/repos/state-hiu/geonode/commits{/sha}","git_commits_url":"https://api.github.com/repos/state-hiu/geonode/git/commits{/sha}","comments_url":"https://api.github.com/repos/state-hiu/geonode/comments{/number}","issue_comment_url":"https://api.github.com/repos/state-hiu/geonode/issues/comments/{number}","contents_url":"https://api.github.com/repos/state-hiu/geonode/contents/{+path}","compare_url":"https://api.github.com/repos/state-hiu/geonode/compare/{base}...{head}","merges_url":"https://api.github.com/repos/state-hiu/geonode/merges","archive_url":"https://api.github.com/repos/state-hiu/geonode/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/state-hiu/geonode/downloads","issues_url":"https://api.github.com/repos/state-hiu/geonode/issues{/number}","pulls_url":"https://api.github.com/repos/state-hiu/geonode/pulls{/number}","milestones_url":"https://api.github.com/repos/state-hiu/geonode/milestones{/number}","notifications_url":"https://api.github.com/repos/state-hiu/geonode/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/state-hiu/geonode/labels{/name}","releases_url":"https://api.github.com/repos/state-hiu/geonode/releases{/id}","created_at":"2013-09-11T20:15:20Z","updated_at":"2015-01-24T01:48:33Z","pushed_at":"2015-01-24T05:19:36Z","git_url":"git://github.com/state-hiu/geonode.git","ssh_url":"git@github.com:state-hiu/geonode.git","clone_url":"https://github.com/state-hiu/geonode.git","svn_url":"https://github.com/state-hiu/geonode","homepage":"http://geonode.org/","size":73619,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_downloads":false,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":11,"forks":0,"open_issues":11,"watchers":1,"default_branch":"master"}},"base":{"label":"GeoNode:master","ref":"master","sha":"129000bfbcd725ea210a92bd7076ecd1d6a78e5f","user":{"login":"GeoNode","id":132843,"avatar_url":"https://avatars.githubusercontent.com/u/132843?v=3","gravatar_id":"","url":"https://api.github.com/users/GeoNode","html_url":"https://github.com/GeoNode","followers_url":"https://api.github.com/users/GeoNode/followers","following_url":"https://api.github.com/users/GeoNode/following{/other_user}","gists_url":"https://api.github.com/users/GeoNode/gists{/gist_id}","starred_url":"https://api.github.com/users/GeoNode/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GeoNode/subscriptions","organizations_url":"https://api.github.com/users/GeoNode/orgs","repos_url":"https://api.github.com/users/GeoNode/repos","events_url":"https://api.github.com/users/GeoNode/events{/privacy}","received_events_url":"https://api.github.com/users/GeoNode/received_events","type":"Organization","site_admin":false},"repo":{"id":701765,"name":"geonode","full_name":"GeoNode/geonode","owner":{"login":"GeoNode","id":132843,"avatar_url":"https://avatars.githubusercontent.com/u/132843?v=3","gravatar_id":"","url":"https://api.github.com/users/GeoNode","html_url":"https://github.com/GeoNode","followers_url":"https://api.github.com/users/GeoNode/followers","following_url":"https://api.github.com/users/GeoNode/following{/other_user}","gists_url":"https://api.github.com/users/GeoNode/gists{/gist_id}","starred_url":"https://api.github.com/users/GeoNode/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GeoNode/subscriptions","organizations_url":"https://api.github.com/users/GeoNode/orgs","repos_url":"https://api.github.com/users/GeoNode/repos","events_url":"https://api.github.com/users/GeoNode/events{/privacy}","received_events_url":"https://api.github.com/users/GeoNode/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/GeoNode/geonode","description":"GeoNode is an open source platform that facilitates the creation, sharing, and collaborative use of geospatial data.","fork":false,"url":"https://api.github.com/repos/GeoNode/geonode","forks_url":"https://api.github.com/repos/GeoNode/geonode/forks","keys_url":"https://api.github.com/repos/GeoNode/geonode/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GeoNode/geonode/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GeoNode/geonode/teams","hooks_url":"https://api.github.com/repos/GeoNode/geonode/hooks","issue_events_url":"https://api.github.com/repos/GeoNode/geonode/issues/events{/number}","events_url":"https://api.github.com/repos/GeoNode/geonode/events","assignees_url":"https://api.github.com/repos/GeoNode/geonode/assignees{/user}","branches_url":"https://api.github.com/repos/GeoNode/geonode/branches{/branch}","tags_url":"https://api.github.com/repos/GeoNode/geonode/tags","blobs_url":"https://api.github.com/repos/GeoNode/geonode/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GeoNode/geonode/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GeoNode/geonode/git/refs{/sha}","trees_url":"https://api.github.com/repos/GeoNode/geonode/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GeoNode/geonode/statuses/{sha}","languages_url":"https://api.github.com/repos/GeoNode/geonode/languages","stargazers_url":"https://api.github.com/repos/GeoNode/geonode/stargazers","contributors_url":"https://api.github.com/repos/GeoNode/geonode/contributors","subscribers_url":"https://api.github.com/repos/GeoNode/geonode/subscribers","subscription_url":"https://api.github.com/repos/GeoNode/geonode/subscription","commits_url":"https://api.github.com/repos/GeoNode/geonode/commits{/sha}","git_commits_url":"https://api.github.com/repos/GeoNode/geonode/git/commits{/sha}","comments_url":"https://api.github.com/repos/GeoNode/geonode/comments{/number}","issue_comment_url":"https://api.github.com/repos/GeoNode/geonode/issues/comments/{number}","contents_url":"https://api.github.com/repos/GeoNode/geonode/contents/{+path}","compare_url":"https://api.github.com/repos/GeoNode/geonode/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GeoNode/geonode/merges","archive_url":"https://api.github.com/repos/GeoNode/geonode/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GeoNode/geonode/downloads","issues_url":"https://api.github.com/repos/GeoNode/geonode/issues{/number}","pulls_url":"https://api.github.com/repos/GeoNode/geonode/pulls{/number}","milestones_url":"https://api.github.com/repos/GeoNode/geonode/milestones{/number}","notifications_url":"https://api.github.com/repos/GeoNode/geonode/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GeoNode/geonode/labels{/name}","releases_url":"https://api.github.com/repos/GeoNode/geonode/releases{/id}","created_at":"2010-06-03T18:14:47Z","updated_at":"2015-01-25T19:55:41Z","pushed_at":"2015-01-23T16:16:38Z","git_url":"git://github.com/GeoNode/geonode.git","ssh_url":"git@github.com:GeoNode/geonode.git","clone_url":"https://github.com/GeoNode/geonode.git","svn_url":"https://github.com/GeoNode/geonode","homepage":"http://geonode.org/","size":97558,"stargazers_count":272,"watchers_count":272,"language":"Python","has_issues":true,"has_downloads":false,"has_wiki":true,"has_pages":false,"forks_count":237,"mirror_url":null,"open_issues_count":266,"forks":237,"open_issues":266,"watchers":272,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/GeoNode/geonode/pulls/1943"},"html":{"href":"https://github.com/GeoNode/geonode/pull/1943"},"issue":{"href":"https://api.github.com/repos/GeoNode/geonode/issues/1943"},"comments":{"href":"https://api.github.com/repos/GeoNode/geonode/issues/1943/comments"},"review_comments":{"href":"https://api.github.com/repos/GeoNode/geonode/pulls/1943/comments"},"review_comment":{"href":"https://api.github.com/repos/GeoNode/geonode/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/GeoNode/geonode/pulls/1943/commits"},"statuses":{"href":"https://api.github.com/repos/GeoNode/geonode/statuses/36fcb3710a0640fc83288c4e4ffcc6f9571b95c0"}}}}