We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Add organisation filter for maps API resources


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `akvo/rest/views/project_update_location.py`
Content:
```
1 # -*- coding: utf-8 -*-
2 
3 # Akvo RSR is covered by the GNU Affero General Public License.
4 # See more details in the license.txt file located at the root folder of the Akvo RSR module.
5 # For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.
6 
7 
8 from akvo.rsr.models import ProjectUpdateLocation
9 from ..serializers import ProjectUpdateLocationSerializer, MapProjectUpdateLocationSerializer
10 from ..viewsets import BaseRSRViewSet
11 
12 
13 class ProjectUpdateLocationViewSet(BaseRSRViewSet):
14     """
15     API endpoint that allows organisation locations to be viewed or edited.
16     """
17     queryset = ProjectUpdateLocation.objects.all()
18     serializer_class = ProjectUpdateLocationSerializer
19 
20 
21 class MapProjectUpdateLocationViewSet(BaseRSRViewSet):
22 
23     """Returns a resource tailored for generating a map of update locations.
24 
25     Allowed parameters are:
26     limit (default 100 / max 500), and
27     location_target__project (filter on project ID)
28     """
29 
30     filter_fields = ('location_target__project', )
31     max_paginate_by = 500
32     paginate_by = 100
33     queryset = ProjectUpdateLocation.objects.select_related(
34         'location_target',
35         'location_target__project').only(
36             'id', 'latitude', 'longitude',
37             'location_target__id', 'location_target__project', 'location_target__title',
38             'location_target__photo', 'location_target__video')
39     serializer_class = MapProjectUpdateLocationSerializer
40
```

Path: `akvo/rest/views/organisation_location.py`
Content:
```
1 # -*- coding: utf-8 -*-
2 """Akvo RSR is covered by the GNU Affero General Public License.
3 See more details in the license.txt file located at the root folder of the Akvo RSR module.
4 For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.
5 """
6 
7 from akvo.rsr.models import OrganisationLocation
8 from ..serializers import OrganisationLocationSerializer, MapOrganisationLocationSerializer
9 from ..viewsets import BaseRSRViewSet
10 
11 
12 class OrganisationLocationViewSet(BaseRSRViewSet):
13     """
14     API endpoint that allows organisation locations to be viewed or edited.
15     """
16     queryset = OrganisationLocation.objects.all()
17     serializer_class = OrganisationLocationSerializer
18 
19 
20 class MapOrganisationLocationViewSet(BaseRSRViewSet):
21 
22     """Returns a resource tailored for generating a map of organisation locations.
23 
24     Allowed parameters are:
25     limit (default 100 / max 500),
26     location_target (filter on organisation ID), and
27     country (filter on country ID)
28     """
29 
30     filter_fields = ('location_target', 'country')
31     max_paginate_by = 500
32     paginate_by = 100
33     queryset = OrganisationLocation.objects.select_related(
34         'location_target', 'country').only(
35             'id', 'latitude', 'longitude',
36             'location_target__id', 'location_target__name',
37             'location_target__logo',
38             'country')
39     serializer_class = MapOrganisationLocationSerializer
40
```

Path: `akvo/rest/views/project_location.py`
Content:
```
1 # -*- coding: utf-8 -*-
2 """Akvo RSR is covered by the GNU Affero General Public License.
3 See more details in the license.txt file located at the root folder of the Akvo RSR module.
4 For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.
5 """
6 
7 from akvo.rsr.models import ProjectLocation
8 from ..serializers import ProjectLocationSerializer, MapProjectLocationSerializer
9 from ..viewsets import BaseRSRViewSet
10 
11 
12 class ProjectLocationViewSet(BaseRSRViewSet):
13     """
14     """
15     queryset = ProjectLocation.objects.all()
16     serializer_class = ProjectLocationSerializer
17     filter_fields = ('location_target', 'country', )
18 
19 
20 class MapProjectLocationViewSet(BaseRSRViewSet):
21 
22     """Returns a resource tailored for generating a map of project locations.
23 
24     Allowed parameters are:
25     limit (default 100 / max 500),
26     location_target (filter on project ID), and
27     country (filter on country ID)
28     """
29 
30     filter_fields = ('location_target', 'country')
31     max_paginate_by = 500
32     paginate_by = 100
33     queryset = ProjectLocation.objects.select_related(
34         'location_target', 'country').only(
35             'id', 'latitude', 'longitude',
36             'location_target__id', 'location_target__title',
37             'location_target__current_image',
38             'country')
39     serializer_class = MapProjectLocationSerializer
40
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/akvo/rest/views/organisation_location.py b/akvo/rest/views/organisation_location.py
--- a/akvo/rest/views/organisation_location.py
+++ b/akvo/rest/views/organisation_location.py
@@ -22,9 +22,9 @@
     """Returns a resource tailored for generating a map of organisation locations.
 
     Allowed parameters are:
-    limit (default 100 / max 500),
-    location_target (filter on organisation ID), and
-    country (filter on country ID)
+    __limit__ (default 100 / max 500),
+    __location_target__ (filter on organisation ID), and
+    __country__ (filter on country ID)
     """
 
     filter_fields = ('location_target', 'country')
diff --git a/akvo/rest/views/project_location.py b/akvo/rest/views/project_location.py
--- a/akvo/rest/views/project_location.py
+++ b/akvo/rest/views/project_location.py
@@ -22,12 +22,17 @@
     """Returns a resource tailored for generating a map of project locations.
 
     Allowed parameters are:
-    limit (default 100 / max 500),
-    location_target (filter on project ID), and
-    country (filter on country ID)
+    __limit__ (default 100 / max 500),
+    __location_target__ (filter on project ID),
+    __location_target\__partners__ (filter on organisation ID), and
+    __country__ (filter on country ID)
     """
 
-    filter_fields = ('location_target', 'country')
+    filter_fields = (
+        'location_target',
+        'location_target__partners',
+        'country'
+    )
     max_paginate_by = 500
     paginate_by = 100
     queryset = ProjectLocation.objects.select_related(
diff --git a/akvo/rest/views/project_update_location.py b/akvo/rest/views/project_update_location.py
--- a/akvo/rest/views/project_update_location.py
+++ b/akvo/rest/views/project_update_location.py
@@ -23,11 +23,18 @@
     """Returns a resource tailored for generating a map of update locations.
 
     Allowed parameters are:
-    limit (default 100 / max 500), and
-    location_target__project (filter on project ID)
+    __limit__ (default 100 / max 500),
+    __location_target\__project__ (filter on project ID),
+    __location_target\__project\__partners__
+    (filter on organisation ID of the projects' organisations),
+    __location_target\__user\__employers__ (filter on organisation ID of the users' organisations)
     """
 
-    filter_fields = ('location_target__project', )
+    filter_fields = (
+        'location_target__project',
+        'location_target__project__partners',
+        'location_target__user__employers'
+    )
     max_paginate_by = 500
     paginate_by = 100
     queryset = ProjectUpdateLocation.objects.select_related(

{"golden_diff": "diff --git a/akvo/rest/views/organisation_location.py b/akvo/rest/views/organisation_location.py\n--- a/akvo/rest/views/organisation_location.py\n+++ b/akvo/rest/views/organisation_location.py\n@@ -22,9 +22,9 @@\n     \"\"\"Returns a resource tailored for generating a map of organisation locations.\n \n     Allowed parameters are:\n-    limit (default 100 / max 500),\n-    location_target (filter on organisation ID), and\n-    country (filter on country ID)\n+    __limit__ (default 100 / max 500),\n+    __location_target__ (filter on organisation ID), and\n+    __country__ (filter on country ID)\n     \"\"\"\n \n     filter_fields = ('location_target', 'country')\ndiff --git a/akvo/rest/views/project_location.py b/akvo/rest/views/project_location.py\n--- a/akvo/rest/views/project_location.py\n+++ b/akvo/rest/views/project_location.py\n@@ -22,12 +22,17 @@\n     \"\"\"Returns a resource tailored for generating a map of project locations.\n \n     Allowed parameters are:\n-    limit (default 100 / max 500),\n-    location_target (filter on project ID), and\n-    country (filter on country ID)\n+    __limit__ (default 100 / max 500),\n+    __location_target__ (filter on project ID),\n+    __location_target\\__partners__ (filter on organisation ID), and\n+    __country__ (filter on country ID)\n     \"\"\"\n \n-    filter_fields = ('location_target', 'country')\n+    filter_fields = (\n+        'location_target',\n+        'location_target__partners',\n+        'country'\n+    )\n     max_paginate_by = 500\n     paginate_by = 100\n     queryset = ProjectLocation.objects.select_related(\ndiff --git a/akvo/rest/views/project_update_location.py b/akvo/rest/views/project_update_location.py\n--- a/akvo/rest/views/project_update_location.py\n+++ b/akvo/rest/views/project_update_location.py\n@@ -23,11 +23,18 @@\n     \"\"\"Returns a resource tailored for generating a map of update locations.\n \n     Allowed parameters are:\n-    limit (default 100 / max 500), and\n-    location_target__project (filter on project ID)\n+    __limit__ (default 100 / max 500),\n+    __location_target\\__project__ (filter on project ID),\n+    __location_target\\__project\\__partners__\n+    (filter on organisation ID of the projects' organisations),\n+    __location_target\\__user\\__employers__ (filter on organisation ID of the users' organisations)\n     \"\"\"\n \n-    filter_fields = ('location_target__project', )\n+    filter_fields = (\n+        'location_target__project',\n+        'location_target__project__partners',\n+        'location_target__user__employers'\n+    )\n     max_paginate_by = 500\n     paginate_by = 100\n     queryset = ProjectUpdateLocation.objects.select_related(\n", "issue": "Add organisation filter for maps API resources\n\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n\n# Akvo RSR is covered by the GNU Affero General Public License.\n# See more details in the license.txt file located at the root folder of the Akvo RSR module.\n# For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.\n\n\nfrom akvo.rsr.models import ProjectUpdateLocation\nfrom ..serializers import ProjectUpdateLocationSerializer, MapProjectUpdateLocationSerializer\nfrom ..viewsets import BaseRSRViewSet\n\n\nclass ProjectUpdateLocationViewSet(BaseRSRViewSet):\n    \"\"\"\n    API endpoint that allows organisation locations to be viewed or edited.\n    \"\"\"\n    queryset = ProjectUpdateLocation.objects.all()\n    serializer_class = ProjectUpdateLocationSerializer\n\n\nclass MapProjectUpdateLocationViewSet(BaseRSRViewSet):\n\n    \"\"\"Returns a resource tailored for generating a map of update locations.\n\n    Allowed parameters are:\n    limit (default 100 / max 500), and\n    location_target__project (filter on project ID)\n    \"\"\"\n\n    filter_fields = ('location_target__project', )\n    max_paginate_by = 500\n    paginate_by = 100\n    queryset = ProjectUpdateLocation.objects.select_related(\n        'location_target',\n        'location_target__project').only(\n            'id', 'latitude', 'longitude',\n            'location_target__id', 'location_target__project', 'location_target__title',\n            'location_target__photo', 'location_target__video')\n    serializer_class = MapProjectUpdateLocationSerializer\n", "path": "akvo/rest/views/project_update_location.py"}, {"content": "# -*- coding: utf-8 -*-\n\"\"\"Akvo RSR is covered by the GNU Affero General Public License.\nSee more details in the license.txt file located at the root folder of the Akvo RSR module.\nFor additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.\n\"\"\"\n\nfrom akvo.rsr.models import OrganisationLocation\nfrom ..serializers import OrganisationLocationSerializer, MapOrganisationLocationSerializer\nfrom ..viewsets import BaseRSRViewSet\n\n\nclass OrganisationLocationViewSet(BaseRSRViewSet):\n    \"\"\"\n    API endpoint that allows organisation locations to be viewed or edited.\n    \"\"\"\n    queryset = OrganisationLocation.objects.all()\n    serializer_class = OrganisationLocationSerializer\n\n\nclass MapOrganisationLocationViewSet(BaseRSRViewSet):\n\n    \"\"\"Returns a resource tailored for generating a map of organisation locations.\n\n    Allowed parameters are:\n    limit (default 100 / max 500),\n    location_target (filter on organisation ID), and\n    country (filter on country ID)\n    \"\"\"\n\n    filter_fields = ('location_target', 'country')\n    max_paginate_by = 500\n    paginate_by = 100\n    queryset = OrganisationLocation.objects.select_related(\n        'location_target', 'country').only(\n            'id', 'latitude', 'longitude',\n            'location_target__id', 'location_target__name',\n            'location_target__logo',\n            'country')\n    serializer_class = MapOrganisationLocationSerializer\n", "path": "akvo/rest/views/organisation_location.py"}, {"content": "# -*- coding: utf-8 -*-\n\"\"\"Akvo RSR is covered by the GNU Affero General Public License.\nSee more details in the license.txt file located at the root folder of the Akvo RSR module.\nFor additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.\n\"\"\"\n\nfrom akvo.rsr.models import ProjectLocation\nfrom ..serializers import ProjectLocationSerializer, MapProjectLocationSerializer\nfrom ..viewsets import BaseRSRViewSet\n\n\nclass ProjectLocationViewSet(BaseRSRViewSet):\n    \"\"\"\n    \"\"\"\n    queryset = ProjectLocation.objects.all()\n    serializer_class = ProjectLocationSerializer\n    filter_fields = ('location_target', 'country', )\n\n\nclass MapProjectLocationViewSet(BaseRSRViewSet):\n\n    \"\"\"Returns a resource tailored for generating a map of project locations.\n\n    Allowed parameters are:\n    limit (default 100 / max 500),\n    location_target (filter on project ID), and\n    country (filter on country ID)\n    \"\"\"\n\n    filter_fields = ('location_target', 'country')\n    max_paginate_by = 500\n    paginate_by = 100\n    queryset = ProjectLocation.objects.select_related(\n        'location_target', 'country').only(\n            'id', 'latitude', 'longitude',\n            'location_target__id', 'location_target__title',\n            'location_target__current_image',\n            'country')\n    serializer_class = MapProjectLocationSerializer\n", "path": "akvo/rest/views/project_location.py"}], "after_files": [{"content": "# -*- coding: utf-8 -*-\n\n# Akvo RSR is covered by the GNU Affero General Public License.\n# See more details in the license.txt file located at the root folder of the Akvo RSR module.\n# For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.\n\n\nfrom akvo.rsr.models import ProjectUpdateLocation\nfrom ..serializers import ProjectUpdateLocationSerializer, MapProjectUpdateLocationSerializer\nfrom ..viewsets import BaseRSRViewSet\n\n\nclass ProjectUpdateLocationViewSet(BaseRSRViewSet):\n    \"\"\"\n    API endpoint that allows organisation locations to be viewed or edited.\n    \"\"\"\n    queryset = ProjectUpdateLocation.objects.all()\n    serializer_class = ProjectUpdateLocationSerializer\n\n\nclass MapProjectUpdateLocationViewSet(BaseRSRViewSet):\n\n    \"\"\"Returns a resource tailored for generating a map of update locations.\n\n    Allowed parameters are:\n    __limit__ (default 100 / max 500),\n    __location_target\\__project__ (filter on project ID),\n    __location_target\\__project\\__partners__\n    (filter on organisation ID of the projects' organisations),\n    __location_target\\__user\\__employers__ (filter on organisation ID of the users' organisations)\n    \"\"\"\n\n    filter_fields = (\n        'location_target__project',\n        'location_target__project__partners',\n        'location_target__user__employers'\n    )\n    max_paginate_by = 500\n    paginate_by = 100\n    queryset = ProjectUpdateLocation.objects.select_related(\n        'location_target',\n        'location_target__project').only(\n            'id', 'latitude', 'longitude',\n            'location_target__id', 'location_target__project', 'location_target__title',\n            'location_target__photo', 'location_target__video')\n    serializer_class = MapProjectUpdateLocationSerializer\n", "path": "akvo/rest/views/project_update_location.py"}, {"content": "# -*- coding: utf-8 -*-\n\"\"\"Akvo RSR is covered by the GNU Affero General Public License.\nSee more details in the license.txt file located at the root folder of the Akvo RSR module.\nFor additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.\n\"\"\"\n\nfrom akvo.rsr.models import OrganisationLocation\nfrom ..serializers import OrganisationLocationSerializer, MapOrganisationLocationSerializer\nfrom ..viewsets import BaseRSRViewSet\n\n\nclass OrganisationLocationViewSet(BaseRSRViewSet):\n    \"\"\"\n    API endpoint that allows organisation locations to be viewed or edited.\n    \"\"\"\n    queryset = OrganisationLocation.objects.all()\n    serializer_class = OrganisationLocationSerializer\n\n\nclass MapOrganisationLocationViewSet(BaseRSRViewSet):\n\n    \"\"\"Returns a resource tailored for generating a map of organisation locations.\n\n    Allowed parameters are:\n    __limit__ (default 100 / max 500),\n    __location_target__ (filter on organisation ID), and\n    __country__ (filter on country ID)\n    \"\"\"\n\n    filter_fields = ('location_target', 'country')\n    max_paginate_by = 500\n    paginate_by = 100\n    queryset = OrganisationLocation.objects.select_related(\n        'location_target', 'country').only(\n            'id', 'latitude', 'longitude',\n            'location_target__id', 'location_target__name',\n            'location_target__logo',\n            'country')\n    serializer_class = MapOrganisationLocationSerializer\n", "path": "akvo/rest/views/organisation_location.py"}, {"content": "# -*- coding: utf-8 -*-\n\"\"\"Akvo RSR is covered by the GNU Affero General Public License.\nSee more details in the license.txt file located at the root folder of the Akvo RSR module.\nFor additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.\n\"\"\"\n\nfrom akvo.rsr.models import ProjectLocation\nfrom ..serializers import ProjectLocationSerializer, MapProjectLocationSerializer\nfrom ..viewsets import BaseRSRViewSet\n\n\nclass ProjectLocationViewSet(BaseRSRViewSet):\n    \"\"\"\n    \"\"\"\n    queryset = ProjectLocation.objects.all()\n    serializer_class = ProjectLocationSerializer\n    filter_fields = ('location_target', 'country', )\n\n\nclass MapProjectLocationViewSet(BaseRSRViewSet):\n\n    \"\"\"Returns a resource tailored for generating a map of project locations.\n\n    Allowed parameters are:\n    __limit__ (default 100 / max 500),\n    __location_target__ (filter on project ID),\n    __location_target\\__partners__ (filter on organisation ID), and\n    __country__ (filter on country ID)\n    \"\"\"\n\n    filter_fields = (\n        'location_target',\n        'location_target__partners',\n        'country'\n    )\n    max_paginate_by = 500\n    paginate_by = 100\n    queryset = ProjectLocation.objects.select_related(\n        'location_target', 'country').only(\n            'id', 'latitude', 'longitude',\n            'location_target__id', 'location_target__title',\n            'location_target__current_image',\n            'country')\n    serializer_class = MapProjectLocationSerializer\n", "path": "akvo/rest/views/project_location.py"}]}