We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Can't add locations to update through REST API
## Test plan

GIVEN the Up app
WHEN the user tries to add an update
THEN this should not give a 400 error


--- 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/serializers/__init__.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
5 Akvo RSR module. For additional details on the GNU license please
6 see < http://www.gnu.org/licenses/agpl.html >.
7 """
8 
9 
10 from .benchmark import BenchmarkSerializer
11 from .benchmark_name import BenchmarknameSerializer
12 from .budget_item import BudgetItemSerializer, CountryBudgetItemSerializer
13 from .budget_item_label import BudgetItemLabelSerializer
14 from .category import CategorySerializer
15 from .country import CountrySerializer
16 from .custom_field import OrganisationCustomFieldSerializer, ProjectCustomFieldSerializer
17 from .employment import EmploymentSerializer
18 from .focus_area import FocusAreaSerializer
19 from .goal import GoalSerializer
20 from .indicator import IndicatorPeriodSerializer, IndicatorSerializer
21 from .internal_organisation_id import InternalOrganisationIDSerializer
22 from .invoice import InvoiceSerializer
23 from .keyword import KeywordSerializer
24 from .legacy_data import LegacyDataSerializer
25 from .link import LinkSerializer
26 from .organisation import OrganisationSerializer
27 from .organisation_location import (OrganisationLocationSerializer,
28                                     MapOrganisationLocationSerializer)
29 from .partner_site import PartnerSiteSerializer
30 from .partnership import PartnershipSerializer
31 from .planned_disbursement import PlannedDisbursementSerializer
32 from .policy_marker import PolicyMarkerSerializer
33 from .project import ProjectSerializer, ProjectExtraSerializer, ProjectUpSerializer
34 from .project_comment import ProjectCommentSerializer
35 from .project_condition import ProjectConditionSerializer
36 from .project_contact import ProjectContactSerializer
37 from .project_document import ProjectDocumentSerializer
38 from .project_location import (ProjectLocationSerializer, AdministrativeLocationSerializer,
39                                MapProjectLocationSerializer)
40 from .project_update import (ProjectUpdateSerializer,
41                              ProjectUpdateExtraSerializer)
42 from .project_update_location import (ProjectUpdateLocationSerializer,
43                                       MapProjectUpdateLocationSerializer)
44 from .publishing_status import PublishingStatusSerializer
45 from .recipient_country import RecipientCountrySerializer
46 from .region import RecipientRegionSerializer
47 from .related_project import RelatedProjectSerializer
48 from .result import ResultSerializer
49 from .sector import SectorSerializer
50 from .transaction import TransactionSerializer, TransactionSectorSerializer
51 from .typeahead import (TypeaheadCountrySerializer,
52                         TypeaheadOrganisationSerializer,
53                         TypeaheadProjectSerializer,
54                         TypeaheadProjectUpdateSerializer)
55 from .user import UserSerializer, UserDetailsSerializer, UserPasswordSerializer
56 
57 __all__ = [
58     'AdministrativeLocationSerializer',
59     'BenchmarknameSerializer',
60     'BenchmarkSerializer',
61     'BudgetItemLabelSerializer',
62     'BudgetItemSerializer',
63     'CategorySerializer',
64     'CountrySerializer',
65     'CountryBudgetItemSerializer',
66     'EmploymentSerializer',
67     'FocusAreaSerializer',
68     'GoalSerializer',
69     'IndicatorPeriodSerializer',
70     'IndicatorSerializer',
71     'InternalOrganisationIDSerializer',
72     'InvoiceSerializer',
73     'KeywordSerializer',
74     'LegacyDataSerializer',
75     'LinkSerializer',
76     'MapOrganisationLocationSerializer',
77     'MapProjectLocationSerializer',
78     'MapProjectUpdateLocationSerializer',
79     'OrganisationSerializer',
80     'OrganisationCustomFieldSerializer',
81     'OrganisationLocationSerializer',
82     'PartnershipSerializer',
83     'PartnerSiteSerializer',
84     'PlannedDisbursementSerializer',
85     'PolicyMarkerSerializer',
86     'ProjectCommentSerializer',
87     'ProjectConditionSerializer',
88     'ProjectContactSerializer',
89     'ProjectCustomFieldSerializer',
90     'ProjectDocumentSerializer',
91     'ProjectExtraSerializer',
92     'ProjectLocationSerializer',
93     'ProjectSerializer',
94     'ProjectUpdateExtraSerializer',
95     'ProjectUpdateLocationSerializer',
96     'ProjectUpdateSerializer',
97     'ProjectUpSerializer',
98     'PublishingStatusSerializer',
99     'RecipientCountrySerializer',
100     'RecipientRegionSerializer',
101     'RelatedProjectSerializer',
102     'ResultSerializer',
103     'SectorSerializer',
104     'TransactionSerializer',
105     'TransactionSectorSerializer',
106     'TypeaheadCountrySerializer',
107     'TypeaheadOrganisationSerializer',
108     'TypeaheadProjectSerializer',
109     'TypeaheadProjectUpdateSerializer',
110     'UserDetailsSerializer',
111     'UserPasswordSerializer',
112     'UserSerializer',
113 ]
114
```

Path: `akvo/rest/serializers/project_update.py`
Content:
```
1 # -*- coding: utf-8 -*-
2 """Akvo RSR is covered by the GNU Affero General Public License.
3 
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 rest_framework import serializers
9 from akvo.rsr.models import ProjectUpdate
10 from ..fields import Base64ImageField
11 from .project_update_location import (ProjectUpdateLocationSerializer,
12                                       ProjectUpdateLocationExtraSerializer)
13 from .rsr_serializer import BaseRSRSerializer
14 from .user import UserSerializer
15 
16 
17 class ProjectUpdateSerializer(BaseRSRSerializer):
18 
19     """Serializer for project updates."""
20 
21     locations = ProjectUpdateLocationSerializer(source='locations', many=True, required=False,
22                                                 allow_add_remove=True)
23     photo = Base64ImageField(required=False, allow_empty_file=True)
24 
25     class Meta:
26         model = ProjectUpdate
27 
28 
29 class ProjectUpdateExtraSerializer(BaseRSRSerializer):
30 
31     """This serializer includes data about user and connected organisation."""
32 
33     photo = Base64ImageField(required=False, allow_empty_file=True)
34     primary_location = ProjectUpdateLocationExtraSerializer()
35     # Limit project data to its PK, this is needed because of Meta.depth = 2
36     project = serializers.Field(source='project.pk')
37     user = UserSerializer()
38 
39     class Meta:
40         model = ProjectUpdate
41         depth = 2
42
```

Path: `akvo/rest/serializers/project_update_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 rest_framework import serializers
8 from akvo.rsr.models import ProjectUpdateLocation
9 from ..fields import Base64ImageField
10 from .rsr_serializer import BaseRSRSerializer
11 
12 
13 class ProjectUpdateLocationSerializer(BaseRSRSerializer):
14 
15     class Meta:
16         model = ProjectUpdateLocation
17 
18 
19 class ProjectUpdateLocationExtraSerializer(ProjectUpdateLocationSerializer):
20 
21     # Limit update data to its PK, this is needed because of Meta.depth = 2
22     location_target = serializers.Field(source='location_target.pk')
23 
24     class Meta(ProjectUpdateLocationSerializer.Meta):
25         depth = 2
26 
27 
28 class MapProjectUpdateSerializer(serializers.Serializer):
29 
30     """To serialize the update field of the update map resource."""
31 
32     id = serializers.IntegerField()
33     title = serializers.CharField()
34     url = serializers.URLField(source='get_absolute_url')
35     photo = Base64ImageField(required=False, allow_empty_file=True)
36     video = serializers.CharField(required=False)
37 
38 
39 class MapProjectUpdateLocationSerializer(serializers.Serializer):
40 
41     """To serialize the update map resource."""
42 
43     id = serializers.IntegerField()
44     latitude = serializers.FloatField()
45     longitude = serializers.FloatField()
46     update = MapProjectUpdateSerializer(source='location_target')
47
```
--- 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/serializers/__init__.py b/akvo/rest/serializers/__init__.py
--- a/akvo/rest/serializers/__init__.py
+++ b/akvo/rest/serializers/__init__.py
@@ -40,6 +40,7 @@
 from .project_update import (ProjectUpdateSerializer,
                              ProjectUpdateExtraSerializer)
 from .project_update_location import (ProjectUpdateLocationSerializer,
+                                      ProjectUpdateLocationNestedSerializer,
                                       MapProjectUpdateLocationSerializer)
 from .publishing_status import PublishingStatusSerializer
 from .recipient_country import RecipientCountrySerializer
@@ -93,6 +94,7 @@
     'ProjectSerializer',
     'ProjectUpdateExtraSerializer',
     'ProjectUpdateLocationSerializer',
+    'ProjectUpdateLocationNestedSerializer',
     'ProjectUpdateSerializer',
     'ProjectUpSerializer',
     'PublishingStatusSerializer',
diff --git a/akvo/rest/serializers/project_update.py b/akvo/rest/serializers/project_update.py
--- a/akvo/rest/serializers/project_update.py
+++ b/akvo/rest/serializers/project_update.py
@@ -8,7 +8,7 @@
 from rest_framework import serializers
 from akvo.rsr.models import ProjectUpdate
 from ..fields import Base64ImageField
-from .project_update_location import (ProjectUpdateLocationSerializer,
+from .project_update_location import (ProjectUpdateLocationNestedSerializer,
                                       ProjectUpdateLocationExtraSerializer)
 from .rsr_serializer import BaseRSRSerializer
 from .user import UserSerializer
@@ -18,8 +18,8 @@
 
     """Serializer for project updates."""
 
-    locations = ProjectUpdateLocationSerializer(source='locations', many=True, required=False,
-                                                allow_add_remove=True)
+    locations = ProjectUpdateLocationNestedSerializer(source='locations', many=True, required=False,
+                                                      allow_add_remove=True)
     photo = Base64ImageField(required=False, allow_empty_file=True)
 
     class Meta:
diff --git a/akvo/rest/serializers/project_update_location.py b/akvo/rest/serializers/project_update_location.py
--- a/akvo/rest/serializers/project_update_location.py
+++ b/akvo/rest/serializers/project_update_location.py
@@ -16,6 +16,14 @@
         model = ProjectUpdateLocation
 
 
+class ProjectUpdateLocationNestedSerializer(ProjectUpdateLocationSerializer):
+
+    class Meta(ProjectUpdateLocationSerializer.Meta):
+        # Exclude the mandatory 'location_target' field, so that it is possible to create a
+        # project update location at the same time as the project update.
+        exclude = ('location_target',)
+
+
 class ProjectUpdateLocationExtraSerializer(ProjectUpdateLocationSerializer):
 
     # Limit update data to its PK, this is needed because of Meta.depth = 2

{"golden_diff": "diff --git a/akvo/rest/serializers/__init__.py b/akvo/rest/serializers/__init__.py\n--- a/akvo/rest/serializers/__init__.py\n+++ b/akvo/rest/serializers/__init__.py\n@@ -40,6 +40,7 @@\n from .project_update import (ProjectUpdateSerializer,\n                              ProjectUpdateExtraSerializer)\n from .project_update_location import (ProjectUpdateLocationSerializer,\n+                                      ProjectUpdateLocationNestedSerializer,\n                                       MapProjectUpdateLocationSerializer)\n from .publishing_status import PublishingStatusSerializer\n from .recipient_country import RecipientCountrySerializer\n@@ -93,6 +94,7 @@\n     'ProjectSerializer',\n     'ProjectUpdateExtraSerializer',\n     'ProjectUpdateLocationSerializer',\n+    'ProjectUpdateLocationNestedSerializer',\n     'ProjectUpdateSerializer',\n     'ProjectUpSerializer',\n     'PublishingStatusSerializer',\ndiff --git a/akvo/rest/serializers/project_update.py b/akvo/rest/serializers/project_update.py\n--- a/akvo/rest/serializers/project_update.py\n+++ b/akvo/rest/serializers/project_update.py\n@@ -8,7 +8,7 @@\n from rest_framework import serializers\n from akvo.rsr.models import ProjectUpdate\n from ..fields import Base64ImageField\n-from .project_update_location import (ProjectUpdateLocationSerializer,\n+from .project_update_location import (ProjectUpdateLocationNestedSerializer,\n                                       ProjectUpdateLocationExtraSerializer)\n from .rsr_serializer import BaseRSRSerializer\n from .user import UserSerializer\n@@ -18,8 +18,8 @@\n \n     \"\"\"Serializer for project updates.\"\"\"\n \n-    locations = ProjectUpdateLocationSerializer(source='locations', many=True, required=False,\n-                                                allow_add_remove=True)\n+    locations = ProjectUpdateLocationNestedSerializer(source='locations', many=True, required=False,\n+                                                      allow_add_remove=True)\n     photo = Base64ImageField(required=False, allow_empty_file=True)\n \n     class Meta:\ndiff --git a/akvo/rest/serializers/project_update_location.py b/akvo/rest/serializers/project_update_location.py\n--- a/akvo/rest/serializers/project_update_location.py\n+++ b/akvo/rest/serializers/project_update_location.py\n@@ -16,6 +16,14 @@\n         model = ProjectUpdateLocation\n \n \n+class ProjectUpdateLocationNestedSerializer(ProjectUpdateLocationSerializer):\n+\n+    class Meta(ProjectUpdateLocationSerializer.Meta):\n+        # Exclude the mandatory 'location_target' field, so that it is possible to create a\n+        # project update location at the same time as the project update.\n+        exclude = ('location_target',)\n+\n+\n class ProjectUpdateLocationExtraSerializer(ProjectUpdateLocationSerializer):\n \n     # Limit update data to its PK, this is needed because of Meta.depth = 2\n", "issue": "Can't add locations to update through REST API\n## Test plan\n\nGIVEN the Up app\nWHEN the user tries to add an update\nTHEN this should not give a 400 error\n\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n\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\nAkvo RSR module. For additional details on the GNU license please\nsee < http://www.gnu.org/licenses/agpl.html >.\n\"\"\"\n\n\nfrom .benchmark import BenchmarkSerializer\nfrom .benchmark_name import BenchmarknameSerializer\nfrom .budget_item import BudgetItemSerializer, CountryBudgetItemSerializer\nfrom .budget_item_label import BudgetItemLabelSerializer\nfrom .category import CategorySerializer\nfrom .country import CountrySerializer\nfrom .custom_field import OrganisationCustomFieldSerializer, ProjectCustomFieldSerializer\nfrom .employment import EmploymentSerializer\nfrom .focus_area import FocusAreaSerializer\nfrom .goal import GoalSerializer\nfrom .indicator import IndicatorPeriodSerializer, IndicatorSerializer\nfrom .internal_organisation_id import InternalOrganisationIDSerializer\nfrom .invoice import InvoiceSerializer\nfrom .keyword import KeywordSerializer\nfrom .legacy_data import LegacyDataSerializer\nfrom .link import LinkSerializer\nfrom .organisation import OrganisationSerializer\nfrom .organisation_location import (OrganisationLocationSerializer,\n                                    MapOrganisationLocationSerializer)\nfrom .partner_site import PartnerSiteSerializer\nfrom .partnership import PartnershipSerializer\nfrom .planned_disbursement import PlannedDisbursementSerializer\nfrom .policy_marker import PolicyMarkerSerializer\nfrom .project import ProjectSerializer, ProjectExtraSerializer, ProjectUpSerializer\nfrom .project_comment import ProjectCommentSerializer\nfrom .project_condition import ProjectConditionSerializer\nfrom .project_contact import ProjectContactSerializer\nfrom .project_document import ProjectDocumentSerializer\nfrom .project_location import (ProjectLocationSerializer, AdministrativeLocationSerializer,\n                               MapProjectLocationSerializer)\nfrom .project_update import (ProjectUpdateSerializer,\n                             ProjectUpdateExtraSerializer)\nfrom .project_update_location import (ProjectUpdateLocationSerializer,\n                                      MapProjectUpdateLocationSerializer)\nfrom .publishing_status import PublishingStatusSerializer\nfrom .recipient_country import RecipientCountrySerializer\nfrom .region import RecipientRegionSerializer\nfrom .related_project import RelatedProjectSerializer\nfrom .result import ResultSerializer\nfrom .sector import SectorSerializer\nfrom .transaction import TransactionSerializer, TransactionSectorSerializer\nfrom .typeahead import (TypeaheadCountrySerializer,\n                        TypeaheadOrganisationSerializer,\n                        TypeaheadProjectSerializer,\n                        TypeaheadProjectUpdateSerializer)\nfrom .user import UserSerializer, UserDetailsSerializer, UserPasswordSerializer\n\n__all__ = [\n    'AdministrativeLocationSerializer',\n    'BenchmarknameSerializer',\n    'BenchmarkSerializer',\n    'BudgetItemLabelSerializer',\n    'BudgetItemSerializer',\n    'CategorySerializer',\n    'CountrySerializer',\n    'CountryBudgetItemSerializer',\n    'EmploymentSerializer',\n    'FocusAreaSerializer',\n    'GoalSerializer',\n    'IndicatorPeriodSerializer',\n    'IndicatorSerializer',\n    'InternalOrganisationIDSerializer',\n    'InvoiceSerializer',\n    'KeywordSerializer',\n    'LegacyDataSerializer',\n    'LinkSerializer',\n    'MapOrganisationLocationSerializer',\n    'MapProjectLocationSerializer',\n    'MapProjectUpdateLocationSerializer',\n    'OrganisationSerializer',\n    'OrganisationCustomFieldSerializer',\n    'OrganisationLocationSerializer',\n    'PartnershipSerializer',\n    'PartnerSiteSerializer',\n    'PlannedDisbursementSerializer',\n    'PolicyMarkerSerializer',\n    'ProjectCommentSerializer',\n    'ProjectConditionSerializer',\n    'ProjectContactSerializer',\n    'ProjectCustomFieldSerializer',\n    'ProjectDocumentSerializer',\n    'ProjectExtraSerializer',\n    'ProjectLocationSerializer',\n    'ProjectSerializer',\n    'ProjectUpdateExtraSerializer',\n    'ProjectUpdateLocationSerializer',\n    'ProjectUpdateSerializer',\n    'ProjectUpSerializer',\n    'PublishingStatusSerializer',\n    'RecipientCountrySerializer',\n    'RecipientRegionSerializer',\n    'RelatedProjectSerializer',\n    'ResultSerializer',\n    'SectorSerializer',\n    'TransactionSerializer',\n    'TransactionSectorSerializer',\n    'TypeaheadCountrySerializer',\n    'TypeaheadOrganisationSerializer',\n    'TypeaheadProjectSerializer',\n    'TypeaheadProjectUpdateSerializer',\n    'UserDetailsSerializer',\n    'UserPasswordSerializer',\n    'UserSerializer',\n]\n", "path": "akvo/rest/serializers/__init__.py"}, {"content": "# -*- coding: utf-8 -*-\n\"\"\"Akvo RSR is covered by the GNU Affero General Public License.\n\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 rest_framework import serializers\nfrom akvo.rsr.models import ProjectUpdate\nfrom ..fields import Base64ImageField\nfrom .project_update_location import (ProjectUpdateLocationSerializer,\n                                      ProjectUpdateLocationExtraSerializer)\nfrom .rsr_serializer import BaseRSRSerializer\nfrom .user import UserSerializer\n\n\nclass ProjectUpdateSerializer(BaseRSRSerializer):\n\n    \"\"\"Serializer for project updates.\"\"\"\n\n    locations = ProjectUpdateLocationSerializer(source='locations', many=True, required=False,\n                                                allow_add_remove=True)\n    photo = Base64ImageField(required=False, allow_empty_file=True)\n\n    class Meta:\n        model = ProjectUpdate\n\n\nclass ProjectUpdateExtraSerializer(BaseRSRSerializer):\n\n    \"\"\"This serializer includes data about user and connected organisation.\"\"\"\n\n    photo = Base64ImageField(required=False, allow_empty_file=True)\n    primary_location = ProjectUpdateLocationExtraSerializer()\n    # Limit project data to its PK, this is needed because of Meta.depth = 2\n    project = serializers.Field(source='project.pk')\n    user = UserSerializer()\n\n    class Meta:\n        model = ProjectUpdate\n        depth = 2\n", "path": "akvo/rest/serializers/project_update.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 rest_framework import serializers\nfrom akvo.rsr.models import ProjectUpdateLocation\nfrom ..fields import Base64ImageField\nfrom .rsr_serializer import BaseRSRSerializer\n\n\nclass ProjectUpdateLocationSerializer(BaseRSRSerializer):\n\n    class Meta:\n        model = ProjectUpdateLocation\n\n\nclass ProjectUpdateLocationExtraSerializer(ProjectUpdateLocationSerializer):\n\n    # Limit update data to its PK, this is needed because of Meta.depth = 2\n    location_target = serializers.Field(source='location_target.pk')\n\n    class Meta(ProjectUpdateLocationSerializer.Meta):\n        depth = 2\n\n\nclass MapProjectUpdateSerializer(serializers.Serializer):\n\n    \"\"\"To serialize the update field of the update map resource.\"\"\"\n\n    id = serializers.IntegerField()\n    title = serializers.CharField()\n    url = serializers.URLField(source='get_absolute_url')\n    photo = Base64ImageField(required=False, allow_empty_file=True)\n    video = serializers.CharField(required=False)\n\n\nclass MapProjectUpdateLocationSerializer(serializers.Serializer):\n\n    \"\"\"To serialize the update map resource.\"\"\"\n\n    id = serializers.IntegerField()\n    latitude = serializers.FloatField()\n    longitude = serializers.FloatField()\n    update = MapProjectUpdateSerializer(source='location_target')\n", "path": "akvo/rest/serializers/project_update_location.py"}], "after_files": [{"content": "# -*- coding: utf-8 -*-\n\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\nAkvo RSR module. For additional details on the GNU license please\nsee < http://www.gnu.org/licenses/agpl.html >.\n\"\"\"\n\n\nfrom .benchmark import BenchmarkSerializer\nfrom .benchmark_name import BenchmarknameSerializer\nfrom .budget_item import BudgetItemSerializer, CountryBudgetItemSerializer\nfrom .budget_item_label import BudgetItemLabelSerializer\nfrom .category import CategorySerializer\nfrom .country import CountrySerializer\nfrom .custom_field import OrganisationCustomFieldSerializer, ProjectCustomFieldSerializer\nfrom .employment import EmploymentSerializer\nfrom .focus_area import FocusAreaSerializer\nfrom .goal import GoalSerializer\nfrom .indicator import IndicatorPeriodSerializer, IndicatorSerializer\nfrom .internal_organisation_id import InternalOrganisationIDSerializer\nfrom .invoice import InvoiceSerializer\nfrom .keyword import KeywordSerializer\nfrom .legacy_data import LegacyDataSerializer\nfrom .link import LinkSerializer\nfrom .organisation import OrganisationSerializer\nfrom .organisation_location import (OrganisationLocationSerializer,\n                                    MapOrganisationLocationSerializer)\nfrom .partner_site import PartnerSiteSerializer\nfrom .partnership import PartnershipSerializer\nfrom .planned_disbursement import PlannedDisbursementSerializer\nfrom .policy_marker import PolicyMarkerSerializer\nfrom .project import ProjectSerializer, ProjectExtraSerializer, ProjectUpSerializer\nfrom .project_comment import ProjectCommentSerializer\nfrom .project_condition import ProjectConditionSerializer\nfrom .project_contact import ProjectContactSerializer\nfrom .project_document import ProjectDocumentSerializer\nfrom .project_location import (ProjectLocationSerializer, AdministrativeLocationSerializer,\n                               MapProjectLocationSerializer)\nfrom .project_update import (ProjectUpdateSerializer,\n                             ProjectUpdateExtraSerializer)\nfrom .project_update_location import (ProjectUpdateLocationSerializer,\n                                      ProjectUpdateLocationNestedSerializer,\n                                      MapProjectUpdateLocationSerializer)\nfrom .publishing_status import PublishingStatusSerializer\nfrom .recipient_country import RecipientCountrySerializer\nfrom .region import RecipientRegionSerializer\nfrom .related_project import RelatedProjectSerializer\nfrom .result import ResultSerializer\nfrom .sector import SectorSerializer\nfrom .transaction import TransactionSerializer, TransactionSectorSerializer\nfrom .typeahead import (TypeaheadCountrySerializer,\n                        TypeaheadOrganisationSerializer,\n                        TypeaheadProjectSerializer,\n                        TypeaheadProjectUpdateSerializer)\nfrom .user import UserSerializer, UserDetailsSerializer, UserPasswordSerializer\n\n__all__ = [\n    'AdministrativeLocationSerializer',\n    'BenchmarknameSerializer',\n    'BenchmarkSerializer',\n    'BudgetItemLabelSerializer',\n    'BudgetItemSerializer',\n    'CategorySerializer',\n    'CountrySerializer',\n    'CountryBudgetItemSerializer',\n    'EmploymentSerializer',\n    'FocusAreaSerializer',\n    'GoalSerializer',\n    'IndicatorPeriodSerializer',\n    'IndicatorSerializer',\n    'InternalOrganisationIDSerializer',\n    'InvoiceSerializer',\n    'KeywordSerializer',\n    'LegacyDataSerializer',\n    'LinkSerializer',\n    'MapOrganisationLocationSerializer',\n    'MapProjectLocationSerializer',\n    'MapProjectUpdateLocationSerializer',\n    'OrganisationSerializer',\n    'OrganisationCustomFieldSerializer',\n    'OrganisationLocationSerializer',\n    'PartnershipSerializer',\n    'PartnerSiteSerializer',\n    'PlannedDisbursementSerializer',\n    'PolicyMarkerSerializer',\n    'ProjectCommentSerializer',\n    'ProjectConditionSerializer',\n    'ProjectContactSerializer',\n    'ProjectCustomFieldSerializer',\n    'ProjectDocumentSerializer',\n    'ProjectExtraSerializer',\n    'ProjectLocationSerializer',\n    'ProjectSerializer',\n    'ProjectUpdateExtraSerializer',\n    'ProjectUpdateLocationSerializer',\n    'ProjectUpdateLocationNestedSerializer',\n    'ProjectUpdateSerializer',\n    'ProjectUpSerializer',\n    'PublishingStatusSerializer',\n    'RecipientCountrySerializer',\n    'RecipientRegionSerializer',\n    'RelatedProjectSerializer',\n    'ResultSerializer',\n    'SectorSerializer',\n    'TransactionSerializer',\n    'TransactionSectorSerializer',\n    'TypeaheadCountrySerializer',\n    'TypeaheadOrganisationSerializer',\n    'TypeaheadProjectSerializer',\n    'TypeaheadProjectUpdateSerializer',\n    'UserDetailsSerializer',\n    'UserPasswordSerializer',\n    'UserSerializer',\n]\n", "path": "akvo/rest/serializers/__init__.py"}, {"content": "# -*- coding: utf-8 -*-\n\"\"\"Akvo RSR is covered by the GNU Affero General Public License.\n\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 rest_framework import serializers\nfrom akvo.rsr.models import ProjectUpdate\nfrom ..fields import Base64ImageField\nfrom .project_update_location import (ProjectUpdateLocationNestedSerializer,\n                                      ProjectUpdateLocationExtraSerializer)\nfrom .rsr_serializer import BaseRSRSerializer\nfrom .user import UserSerializer\n\n\nclass ProjectUpdateSerializer(BaseRSRSerializer):\n\n    \"\"\"Serializer for project updates.\"\"\"\n\n    locations = ProjectUpdateLocationNestedSerializer(source='locations', many=True, required=False,\n                                                      allow_add_remove=True)\n    photo = Base64ImageField(required=False, allow_empty_file=True)\n\n    class Meta:\n        model = ProjectUpdate\n\n\nclass ProjectUpdateExtraSerializer(BaseRSRSerializer):\n\n    \"\"\"This serializer includes data about user and connected organisation.\"\"\"\n\n    photo = Base64ImageField(required=False, allow_empty_file=True)\n    primary_location = ProjectUpdateLocationExtraSerializer()\n    # Limit project data to its PK, this is needed because of Meta.depth = 2\n    project = serializers.Field(source='project.pk')\n    user = UserSerializer()\n\n    class Meta:\n        model = ProjectUpdate\n        depth = 2\n", "path": "akvo/rest/serializers/project_update.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 rest_framework import serializers\nfrom akvo.rsr.models import ProjectUpdateLocation\nfrom ..fields import Base64ImageField\nfrom .rsr_serializer import BaseRSRSerializer\n\n\nclass ProjectUpdateLocationSerializer(BaseRSRSerializer):\n\n    class Meta:\n        model = ProjectUpdateLocation\n\n\nclass ProjectUpdateLocationNestedSerializer(ProjectUpdateLocationSerializer):\n\n    class Meta(ProjectUpdateLocationSerializer.Meta):\n        # Exclude the mandatory 'location_target' field, so that it is possible to create a\n        # project update location at the same time as the project update.\n        exclude = ('location_target',)\n\n\nclass ProjectUpdateLocationExtraSerializer(ProjectUpdateLocationSerializer):\n\n    # Limit update data to its PK, this is needed because of Meta.depth = 2\n    location_target = serializers.Field(source='location_target.pk')\n\n    class Meta(ProjectUpdateLocationSerializer.Meta):\n        depth = 2\n\n\nclass MapProjectUpdateSerializer(serializers.Serializer):\n\n    \"\"\"To serialize the update field of the update map resource.\"\"\"\n\n    id = serializers.IntegerField()\n    title = serializers.CharField()\n    url = serializers.URLField(source='get_absolute_url')\n    photo = Base64ImageField(required=False, allow_empty_file=True)\n    video = serializers.CharField(required=False)\n\n\nclass MapProjectUpdateLocationSerializer(serializers.Serializer):\n\n    \"\"\"To serialize the update map resource.\"\"\"\n\n    id = serializers.IntegerField()\n    latitude = serializers.FloatField()\n    longitude = serializers.FloatField()\n    update = MapProjectUpdateSerializer(source='location_target')\n", "path": "akvo/rest/serializers/project_update_location.py"}]}