prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  /related_project/ issue
  Attempted to POST the following data:
  {"relation":"1","project":"8012","related_iati_id":"23232"}
  
  The response is 400:
  `related_project: ["This field is required."]`
  
  However, we want to allow a selection of external project:
  <img width="1440" alt="Screenshot 2019-08-16 10 16 11" src="https://user-images.githubusercontent.com/1336477/63150230-effe3400-c00e-11e9-8aff-dc162686751a.png">
  
  
  </issue>
  <code>
  [start of akvo/rest/serializers/related_project.py]
  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 RelatedProject
  9 
  10 from .rsr_serializer import BaseRSRSerializer
  11 
  12 from rest_framework import serializers
  13 
  14 
  15 class RelatedProjectRawSerializer(BaseRSRSerializer):
  16 
  17     class Meta:
  18         model = RelatedProject
  19         fields = '__all__'
  20 
  21 
  22 class RelatedProjectSerializer(RelatedProjectRawSerializer):
  23 
  24     related_project_name = serializers.ReadOnlyField(source='related_project.title')
  25     related_project_show_link = serializers.ReadOnlyField()
  26     relation_label = serializers.ReadOnlyField(source='iati_relation_unicode')
  27
  [end of akvo/rest/serializers/related_project.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/akvo/rest/serializers/related_project.py b/akvo/rest/serializers/related_project.py
  --- a/akvo/rest/serializers/related_project.py
  +++ b/akvo/rest/serializers/related_project.py
  @@ -5,7 +5,7 @@
   # For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.
   
   
  -from akvo.rsr.models import RelatedProject
  +from akvo.rsr.models import RelatedProject, Project
   
   from .rsr_serializer import BaseRSRSerializer
   
  @@ -14,6 +14,9 @@
   
   class RelatedProjectRawSerializer(BaseRSRSerializer):
   
  +    related_project = serializers.PrimaryKeyRelatedField(
  +        allow_null=True, queryset=Project.objects.all(), required=False, default=None)
  +
       class Meta:
           model = RelatedProject
           fields = '__all__'
  
verification_info: {"golden_diff": "diff --git a/akvo/rest/serializers/related_project.py b/akvo/rest/serializers/related_project.py\n--- a/akvo/rest/serializers/related_project.py\n+++ b/akvo/rest/serializers/related_project.py\n@@ -5,7 +5,7 @@\n # For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.\n \n \n-from akvo.rsr.models import RelatedProject\n+from akvo.rsr.models import RelatedProject, Project\n \n from .rsr_serializer import BaseRSRSerializer\n \n@@ -14,6 +14,9 @@\n \n class RelatedProjectRawSerializer(BaseRSRSerializer):\n \n+    related_project = serializers.PrimaryKeyRelatedField(\n+        allow_null=True, queryset=Project.objects.all(), required=False, default=None)\n+\n     class Meta:\n         model = RelatedProject\n         fields = '__all__'\n", "issue": "/related_project/ issue\nAttempted to POST the following data:\r\n{\"relation\":\"1\",\"project\":\"8012\",\"related_iati_id\":\"23232\"}\r\n\r\nThe response is 400:\r\n`related_project: [\"This field is required.\"]`\r\n\r\nHowever, we want to allow a selection of external project:\r\n<img width=\"1440\" alt=\"Screenshot 2019-08-16 10 16 11\" src=\"https://user-images.githubusercontent.com/1336477/63150230-effe3400-c00e-11e9-8aff-dc162686751a.png\">\r\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 RelatedProject\n\nfrom .rsr_serializer import BaseRSRSerializer\n\nfrom rest_framework import serializers\n\n\nclass RelatedProjectRawSerializer(BaseRSRSerializer):\n\n    class Meta:\n        model = RelatedProject\n        fields = '__all__'\n\n\nclass RelatedProjectSerializer(RelatedProjectRawSerializer):\n\n    related_project_name = serializers.ReadOnlyField(source='related_project.title')\n    related_project_show_link = serializers.ReadOnlyField()\n    relation_label = serializers.ReadOnlyField(source='iati_relation_unicode')\n", "path": "akvo/rest/serializers/related_project.py"}]}