{"action":"created","comment":{"url":"https://api.github.com/repos/flavour/eden/pulls/comments/26467049","id":26467049,"diff_hunk":"@@ -267,36 +264,149 @@ def model(self):\n             # Default\n             create_next = None\n \n-        list_fields = [\"id\"]\n+        # Which levels of Hierarchy are we using?\n+        levels = current.gis.get_relevant_hierarchy_levels()\n+        location_fields = [\"location.location_id$%s\" % level for level in levels]\n+\n+        # List Fields \n+        list_fields = [\"id\",\n+                       \"name\",\n+                       \"status_id\",\n+                       \"organisation_id\"]\n         append = list_fields.append\n+        extend = list_fields.extend\n         if use_codes:\n             append(\"code\")\n-        append(\"name\")\n-        append(\"organisation_id\")\n         if mode_3w:\n-            append((T(\"Locations\"), \"location.location_id\"))\n+            extend(location_fields)\n+            append((T(\"Location\"), \"location.location_id\"))\n         if programmes:\n             append((T(\"Programme\"), \"programme.name\"))\n         if use_sectors:\n-            append((T(\"Sectors\"), \"sector.name\"))\n+            append(\"sector.name\")\n         if mode_drr:\n             append((T(\"Hazards\"), \"hazard.name\"))\n-            #append(\"drr.hfa\")\n-        append((T(\"Themes\"), \"theme.name\"))\n+        if use_themes:\n+            append((T(\"Themes\"), \"theme.name\"))\n+        if mode_drr:\n+            append(\"drr.hfa\")\n         if multi_orgs:\n+            append(\"partner.organisation_id\")\n+            append(\"donor.organisation_id\")\n             append((T(\"Total Funding Amount\"), \"total_organisation_amount\"))\n         if multi_budgets:\n             append((T(\"Total Annual Budget\"), \"total_annual_budget\"))\n-        list_fields += [\"start_date\",\n-                        \"end_date\",\n-                        \"location.location_id\",\n-                        ]\n+        extend((\"start_date\", \"end_date\"))\n+\n+        # Filter widgets\n+        text_filter_fields = [\"name\",\n+                              \"status_id\",\n+                              \"description\",\n+                              \"organisation_id\"]\n+        filter_widgets = [\n+           S3OptionsFilter(\"status_id\",\n+                            label = T(\"Status\"),\n+                            cols = 4,\n+                            ),\n+            S3OptionsFilter(\"organisation_id\",\n+                            label = org_label,\n+                            # Can be unhidden in customise_xx_resource if there is a need to use a default_filter\n+                            hidden = True,\n+                            ),\n+                          ]\n+        append = filter_widgets.append\n+        append_text_filter_fields = text_filter_fields.append\n+        extend_text_filter_fields = text_filter_fields.extend\n+        if use_codes:\n+            append_text_filter_fields(\"code\")\n+        if mode_3w:\n+            extend_text_filter_fields(location_fields)\n+            append(S3LocationFilter(\"location.location_id\",\n+                                    # Default should introspect\n+                                    levels = levels,\n+                                    hidden = True)\n+                   )\n+        if programmes:\n+            append(S3OptionsFilter(\"programme_project.programme_id\",\n+                                   label = T(\"Programme\"),\n+                                   hidden = True)\n+                   )\n+        if use_sectors:\n+            append_text_filter_fields(\"sector.name\")\n+            append(S3OptionsFilter(\"sector_project.sector_id\",\n+                                                  location_filter = True,\n+                                                  none = True,\n+                                                  hidden = True)\n+                                  )\n+        if mode_drr:\n+            append_text_filter_fields(\"hazard.name\")\n+            append(S3OptionsFilter(\"hazard_project.hazard_id\",\n+                                    label = T(\"Hazard\"),\n+                                    help_field = project_hazard_help_fields,\n+                                    cols = 4,\n+                                    hidden = True)\n+                                    )\n+        if use_themes:\n+            append_text_filter_fields(\"theme.name\")\n+            append(S3OptionsFilter(\"theme_project.theme_id\",\n+                                    label = T(\"Theme\"),\n+                                    help_field = project_theme_help_fields,\n+                                    cols = 4,\n+                                    hidden = True)","path":"modules/s3db/project.py","position":129,"original_position":129,"commit_id":"a3ad4fd4fa4b3d15da753308bd4cba42eba83393","original_commit_id":"a3ad4fd4fa4b3d15da753308bd4cba42eba83393","user":{"login":"nursix","id":1257183,"avatar_url":"https://avatars.githubusercontent.com/u/1257183?v=3","gravatar_id":"","url":"https://api.github.com/users/nursix","html_url":"https://github.com/nursix","followers_url":"https://api.github.com/users/nursix/followers","following_url":"https://api.github.com/users/nursix/following{/other_user}","gists_url":"https://api.github.com/users/nursix/gists{/gist_id}","starred_url":"https://api.github.com/users/nursix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nursix/subscriptions","organizations_url":"https://api.github.com/users/nursix/orgs","repos_url":"https://api.github.com/users/nursix/repos","events_url":"https://api.github.com/users/nursix/events{/privacy}","received_events_url":"https://api.github.com/users/nursix/received_events","type":"User","site_admin":false},"body":"...and here","created_at":"2015-03-16T08:29:24Z","updated_at":"2015-03-16T08:29:24Z","html_url":"https://github.com/flavour/eden/pull/1074#discussion_r26467049","pull_request_url":"https://api.github.com/repos/flavour/eden/pulls/1074","_links":{"self":{"href":"https://api.github.com/repos/flavour/eden/pulls/comments/26467049"},"html":{"href":"https://github.com/flavour/eden/pull/1074#discussion_r26467049"},"pull_request":{"href":"https://api.github.com/repos/flavour/eden/pulls/1074"}}},"pull_request":{"url":"https://api.github.com/repos/flavour/eden/pulls/1074","id":31004465,"html_url":"https://github.com/flavour/eden/pull/1074","diff_url":"https://github.com/flavour/eden/pull/1074.diff","patch_url":"https://github.com/flavour/eden/pull/1074.patch","issue_url":"https://api.github.com/repos/flavour/eden/issues/1074","number":1074,"state":"open","locked":false,"title":"Updates from SahanaCamp Turkey branch","user":{"login":"michaelhowden","id":1373438,"avatar_url":"https://avatars.githubusercontent.com/u/1373438?v=3","gravatar_id":"","url":"https://api.github.com/users/michaelhowden","html_url":"https://github.com/michaelhowden","followers_url":"https://api.github.com/users/michaelhowden/followers","following_url":"https://api.github.com/users/michaelhowden/following{/other_user}","gists_url":"https://api.github.com/users/michaelhowden/gists{/gist_id}","starred_url":"https://api.github.com/users/michaelhowden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaelhowden/subscriptions","organizations_url":"https://api.github.com/users/michaelhowden/orgs","repos_url":"https://api.github.com/users/michaelhowden/repos","events_url":"https://api.github.com/users/michaelhowden/events{/privacy}","received_events_url":"https://api.github.com/users/michaelhowden/received_events","type":"User","site_admin":false},"body":"* Default \"index\" resources to summary method\r\n* Adding Report Options & Defaults\r\n* Removing extra embedded table if there is no Org Logo (return \"\")\r\n* Menus check if skills and certificates are enabled\r\n* Remove rheader borders & backgrounds\r\n* Better introspect project menus, list_fields, filters and report_options","created_at":"2015-03-12T02:52:22Z","updated_at":"2015-03-16T08:29:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cf18eb1fbc651dea253d9cf9c1661caee1333a61","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/flavour/eden/pulls/1074/commits","review_comments_url":"https://api.github.com/repos/flavour/eden/pulls/1074/comments","review_comment_url":"https://api.github.com/repos/flavour/eden/pulls/comments{/number}","comments_url":"https://api.github.com/repos/flavour/eden/issues/1074/comments","statuses_url":"https://api.github.com/repos/flavour/eden/statuses/a3ad4fd4fa4b3d15da753308bd4cba42eba83393","head":{"label":"michaelhowden:master","ref":"master","sha":"a3ad4fd4fa4b3d15da753308bd4cba42eba83393","user":{"login":"michaelhowden","id":1373438,"avatar_url":"https://avatars.githubusercontent.com/u/1373438?v=3","gravatar_id":"","url":"https://api.github.com/users/michaelhowden","html_url":"https://github.com/michaelhowden","followers_url":"https://api.github.com/users/michaelhowden/followers","following_url":"https://api.github.com/users/michaelhowden/following{/other_user}","gists_url":"https://api.github.com/users/michaelhowden/gists{/gist_id}","starred_url":"https://api.github.com/users/michaelhowden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaelhowden/subscriptions","organizations_url":"https://api.github.com/users/michaelhowden/orgs","repos_url":"https://api.github.com/users/michaelhowden/repos","events_url":"https://api.github.com/users/michaelhowden/events{/privacy}","received_events_url":"https://api.github.com/users/michaelhowden/received_events","type":"User","site_admin":false},"repo":{"id":3252782,"name":"eden","full_name":"michaelhowden/eden","owner":{"login":"michaelhowden","id":1373438,"avatar_url":"https://avatars.githubusercontent.com/u/1373438?v=3","gravatar_id":"","url":"https://api.github.com/users/michaelhowden","html_url":"https://github.com/michaelhowden","followers_url":"https://api.github.com/users/michaelhowden/followers","following_url":"https://api.github.com/users/michaelhowden/following{/other_user}","gists_url":"https://api.github.com/users/michaelhowden/gists{/gist_id}","starred_url":"https://api.github.com/users/michaelhowden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaelhowden/subscriptions","organizations_url":"https://api.github.com/users/michaelhowden/orgs","repos_url":"https://api.github.com/users/michaelhowden/repos","events_url":"https://api.github.com/users/michaelhowden/events{/privacy}","received_events_url":"https://api.github.com/users/michaelhowden/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/michaelhowden/eden","description":"Sahana Eden is an Open Source Humanitarian Platform which can be used to provide solutions for Disaster Management, Development, and Environmental Management sectors.","fork":true,"url":"https://api.github.com/repos/michaelhowden/eden","forks_url":"https://api.github.com/repos/michaelhowden/eden/forks","keys_url":"https://api.github.com/repos/michaelhowden/eden/keys{/key_id}","collaborators_url":"https://api.github.com/repos/michaelhowden/eden/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/michaelhowden/eden/teams","hooks_url":"https://api.github.com/repos/michaelhowden/eden/hooks","issue_events_url":"https://api.github.com/repos/michaelhowden/eden/issues/events{/number}","events_url":"https://api.github.com/repos/michaelhowden/eden/events","assignees_url":"https://api.github.com/repos/michaelhowden/eden/assignees{/user}","branches_url":"https://api.github.com/repos/michaelhowden/eden/branches{/branch}","tags_url":"https://api.github.com/repos/michaelhowden/eden/tags","blobs_url":"https://api.github.com/repos/michaelhowden/eden/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/michaelhowden/eden/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/michaelhowden/eden/git/refs{/sha}","trees_url":"https://api.github.com/repos/michaelhowden/eden/git/trees{/sha}","statuses_url":"https://api.github.com/repos/michaelhowden/eden/statuses/{sha}","languages_url":"https://api.github.com/repos/michaelhowden/eden/languages","stargazers_url":"https://api.github.com/repos/michaelhowden/eden/stargazers","contributors_url":"https://api.github.com/repos/michaelhowden/eden/contributors","subscribers_url":"https://api.github.com/repos/michaelhowden/eden/subscribers","subscription_url":"https://api.github.com/repos/michaelhowden/eden/subscription","commits_url":"https://api.github.com/repos/michaelhowden/eden/commits{/sha}","git_commits_url":"https://api.github.com/repos/michaelhowden/eden/git/commits{/sha}","comments_url":"https://api.github.com/repos/michaelhowden/eden/comments{/number}","issue_comment_url":"https://api.github.com/repos/michaelhowden/eden/issues/comments{/number}","contents_url":"https://api.github.com/repos/michaelhowden/eden/contents/{+path}","compare_url":"https://api.github.com/repos/michaelhowden/eden/compare/{base}...{head}","merges_url":"https://api.github.com/repos/michaelhowden/eden/merges","archive_url":"https://api.github.com/repos/michaelhowden/eden/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/michaelhowden/eden/downloads","issues_url":"https://api.github.com/repos/michaelhowden/eden/issues{/number}","pulls_url":"https://api.github.com/repos/michaelhowden/eden/pulls{/number}","milestones_url":"https://api.github.com/repos/michaelhowden/eden/milestones{/number}","notifications_url":"https://api.github.com/repos/michaelhowden/eden/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/michaelhowden/eden/labels{/name}","releases_url":"https://api.github.com/repos/michaelhowden/eden/releases{/id}","created_at":"2012-01-24T02:58:24Z","updated_at":"2015-03-16T08:06:12Z","pushed_at":"2015-03-16T08:06:12Z","git_url":"git://github.com/michaelhowden/eden.git","ssh_url":"git@github.com:michaelhowden/eden.git","clone_url":"https://github.com/michaelhowden/eden.git","svn_url":"https://github.com/michaelhowden/eden","homepage":"http://eden.sahanafoundation.org","size":140534,"stargazers_count":2,"watchers_count":2,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":2,"default_branch":"master"}},"base":{"label":"flavour:master","ref":"master","sha":"072c959f5b5697ab2b9eacefa71a7304e85bdb28","user":{"login":"flavour","id":389592,"avatar_url":"https://avatars.githubusercontent.com/u/389592?v=3","gravatar_id":"","url":"https://api.github.com/users/flavour","html_url":"https://github.com/flavour","followers_url":"https://api.github.com/users/flavour/followers","following_url":"https://api.github.com/users/flavour/following{/other_user}","gists_url":"https://api.github.com/users/flavour/gists{/gist_id}","starred_url":"https://api.github.com/users/flavour/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flavour/subscriptions","organizations_url":"https://api.github.com/users/flavour/orgs","repos_url":"https://api.github.com/users/flavour/repos","events_url":"https://api.github.com/users/flavour/events{/privacy}","received_events_url":"https://api.github.com/users/flavour/received_events","type":"User","site_admin":false},"repo":{"id":3021325,"name":"eden","full_name":"flavour/eden","owner":{"login":"flavour","id":389592,"avatar_url":"https://avatars.githubusercontent.com/u/389592?v=3","gravatar_id":"","url":"https://api.github.com/users/flavour","html_url":"https://github.com/flavour","followers_url":"https://api.github.com/users/flavour/followers","following_url":"https://api.github.com/users/flavour/following{/other_user}","gists_url":"https://api.github.com/users/flavour/gists{/gist_id}","starred_url":"https://api.github.com/users/flavour/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flavour/subscriptions","organizations_url":"https://api.github.com/users/flavour/orgs","repos_url":"https://api.github.com/users/flavour/repos","events_url":"https://api.github.com/users/flavour/events{/privacy}","received_events_url":"https://api.github.com/users/flavour/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/flavour/eden","description":"Sahana Eden is an Open Source Humanitarian Platform which can be used to provide solutions for Disaster Management, Development, and Environmental Management sectors.. Please sign CLA when submitting pull requests: http://bit.ly/SSF-eCLA","fork":false,"url":"https://api.github.com/repos/flavour/eden","forks_url":"https://api.github.com/repos/flavour/eden/forks","keys_url":"https://api.github.com/repos/flavour/eden/keys{/key_id}","collaborators_url":"https://api.github.com/repos/flavour/eden/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/flavour/eden/teams","hooks_url":"https://api.github.com/repos/flavour/eden/hooks","issue_events_url":"https://api.github.com/repos/flavour/eden/issues/events{/number}","events_url":"https://api.github.com/repos/flavour/eden/events","assignees_url":"https://api.github.com/repos/flavour/eden/assignees{/user}","branches_url":"https://api.github.com/repos/flavour/eden/branches{/branch}","tags_url":"https://api.github.com/repos/flavour/eden/tags","blobs_url":"https://api.github.com/repos/flavour/eden/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/flavour/eden/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/flavour/eden/git/refs{/sha}","trees_url":"https://api.github.com/repos/flavour/eden/git/trees{/sha}","statuses_url":"https://api.github.com/repos/flavour/eden/statuses/{sha}","languages_url":"https://api.github.com/repos/flavour/eden/languages","stargazers_url":"https://api.github.com/repos/flavour/eden/stargazers","contributors_url":"https://api.github.com/repos/flavour/eden/contributors","subscribers_url":"https://api.github.com/repos/flavour/eden/subscribers","subscription_url":"https://api.github.com/repos/flavour/eden/subscription","commits_url":"https://api.github.com/repos/flavour/eden/commits{/sha}","git_commits_url":"https://api.github.com/repos/flavour/eden/git/commits{/sha}","comments_url":"https://api.github.com/repos/flavour/eden/comments{/number}","issue_comment_url":"https://api.github.com/repos/flavour/eden/issues/comments{/number}","contents_url":"https://api.github.com/repos/flavour/eden/contents/{+path}","compare_url":"https://api.github.com/repos/flavour/eden/compare/{base}...{head}","merges_url":"https://api.github.com/repos/flavour/eden/merges","archive_url":"https://api.github.com/repos/flavour/eden/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/flavour/eden/downloads","issues_url":"https://api.github.com/repos/flavour/eden/issues{/number}","pulls_url":"https://api.github.com/repos/flavour/eden/pulls{/number}","milestones_url":"https://api.github.com/repos/flavour/eden/milestones{/number}","notifications_url":"https://api.github.com/repos/flavour/eden/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/flavour/eden/labels{/name}","releases_url":"https://api.github.com/repos/flavour/eden/releases{/id}","created_at":"2011-12-20T17:49:16Z","updated_at":"2015-03-13T19:40:37Z","pushed_at":"2015-03-13T13:41:21Z","git_url":"git://github.com/flavour/eden.git","ssh_url":"git@github.com:flavour/eden.git","clone_url":"https://github.com/flavour/eden.git","svn_url":"https://github.com/flavour/eden","homepage":"http://eden.sahanafoundation.org","size":180314,"stargazers_count":163,"watchers_count":163,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":418,"mirror_url":null,"open_issues_count":54,"forks":418,"open_issues":54,"watchers":163,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/flavour/eden/pulls/1074"},"html":{"href":"https://github.com/flavour/eden/pull/1074"},"issue":{"href":"https://api.github.com/repos/flavour/eden/issues/1074"},"comments":{"href":"https://api.github.com/repos/flavour/eden/issues/1074/comments"},"review_comments":{"href":"https://api.github.com/repos/flavour/eden/pulls/1074/comments"},"review_comment":{"href":"https://api.github.com/repos/flavour/eden/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/flavour/eden/pulls/1074/commits"},"statuses":{"href":"https://api.github.com/repos/flavour/eden/statuses/a3ad4fd4fa4b3d15da753308bd4cba42eba83393"}}}}