prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Event (registration) status message in the API
  ### Is your feature request related to a problem? Please describe.
  Currently, the event status messages (like 'you cannot cancel your registration without having to pay a fine') are hardcoded and whenever we update them, we must also update the app
  
  ### Describe the solution you'd like
  Put the message in the API
  
  ### Additional context
  Also checkout #1381 
  
  </issue>
  <code>
  [start of website/events/api/v2/serializers/event.py]
  1 from rest_framework import serializers
  2 
  3 from activemembers.api.v2.serializers.member_group import MemberGroupSerializer
  4 from announcements.api.v2.serializers import SlideSerializer
  5 from documents.api.v2.serializers.document import DocumentSerializer
  6 from events import services
  7 from events.api.v2.serializers.event_registration import EventRegistrationSerializer
  8 from events.models import Event, EventRegistration
  9 from thaliawebsite.api.v2.serializers import CleanedHTMLSerializer
  10 from utils.snippets import create_google_maps_url
  11 
  12 
  13 class EventSerializer(serializers.ModelSerializer):
  14     """Serializer for events."""
  15 
  16     class Meta:
  17         model = Event
  18         fields = (
  19             "pk",
  20             "title",
  21             "description",
  22             "start",
  23             "end",
  24             "category",
  25             "registration_start",
  26             "registration_end",
  27             "cancel_deadline",
  28             "optional_registrations",
  29             "location",
  30             "price",
  31             "fine",
  32             "num_participants",
  33             "max_participants",
  34             "no_registration_message",
  35             "has_fields",
  36             "food_event",
  37             "maps_url",
  38             "user_permissions",
  39             "user_registration",
  40             "organiser",
  41             "slide",
  42             "documents",
  43         )
  44 
  45     description = CleanedHTMLSerializer()
  46     organiser = MemberGroupSerializer()
  47     user_registration = serializers.SerializerMethodField("_user_registration")
  48     num_participants = serializers.SerializerMethodField("_num_participants")
  49     maps_url = serializers.SerializerMethodField("_maps_url")
  50     price = serializers.DecimalField(max_digits=5, decimal_places=2)
  51     fine = serializers.DecimalField(max_digits=5, decimal_places=2)
  52     slide = SlideSerializer()
  53     documents = DocumentSerializer(many=True)
  54     user_permissions = serializers.SerializerMethodField("_user_permissions")
  55 
  56     def _user_registration(self, instance):
  57         try:
  58             if self.context["request"].member:
  59                 reg = instance.eventregistration_set.get(
  60                     member=self.context["request"].member, date_cancelled=None
  61                 )
  62                 return EventRegistrationSerializer(
  63                     reg,
  64                     context=self.context,
  65                     fields=("pk", "present", "queue_position", "date", "payment"),
  66                 ).data
  67         except EventRegistration.DoesNotExist:
  68             pass
  69         return None
  70 
  71     def _num_participants(self, instance):
  72         if (
  73             instance.max_participants
  74             and instance.participants.count() > instance.max_participants
  75         ):
  76             return instance.max_participants
  77         return instance.participants.count()
  78 
  79     def _user_permissions(self, instance):
  80         member = self.context["request"].member
  81         return services.event_permissions(member, instance)
  82 
  83     def _maps_url(self, instance):
  84         return create_google_maps_url(instance.map_location, zoom=13, size="450x250")
  85
  [end of website/events/api/v2/serializers/event.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/website/events/api/v2/serializers/event.py b/website/events/api/v2/serializers/event.py
  --- a/website/events/api/v2/serializers/event.py
  +++ b/website/events/api/v2/serializers/event.py
  @@ -32,6 +32,7 @@
               "num_participants",
               "max_participants",
               "no_registration_message",
  +            "cancel_too_late_message",
               "has_fields",
               "food_event",
               "maps_url",
  
verification_info: {"golden_diff": "diff --git a/website/events/api/v2/serializers/event.py b/website/events/api/v2/serializers/event.py\n--- a/website/events/api/v2/serializers/event.py\n+++ b/website/events/api/v2/serializers/event.py\n@@ -32,6 +32,7 @@\n             \"num_participants\",\n             \"max_participants\",\n             \"no_registration_message\",\n+            \"cancel_too_late_message\",\n             \"has_fields\",\n             \"food_event\",\n             \"maps_url\",\n", "issue": "Event (registration) status message in the API\n### Is your feature request related to a problem? Please describe.\r\nCurrently, the event status messages (like 'you cannot cancel your registration without having to pay a fine') are hardcoded and whenever we update them, we must also update the app\r\n\r\n### Describe the solution you'd like\r\nPut the message in the API\r\n\r\n### Additional context\r\nAlso checkout #1381 \n", "before_files": [{"content": "from rest_framework import serializers\n\nfrom activemembers.api.v2.serializers.member_group import MemberGroupSerializer\nfrom announcements.api.v2.serializers import SlideSerializer\nfrom documents.api.v2.serializers.document import DocumentSerializer\nfrom events import services\nfrom events.api.v2.serializers.event_registration import EventRegistrationSerializer\nfrom events.models import Event, EventRegistration\nfrom thaliawebsite.api.v2.serializers import CleanedHTMLSerializer\nfrom utils.snippets import create_google_maps_url\n\n\nclass EventSerializer(serializers.ModelSerializer):\n    \"\"\"Serializer for events.\"\"\"\n\n    class Meta:\n        model = Event\n        fields = (\n            \"pk\",\n            \"title\",\n            \"description\",\n            \"start\",\n            \"end\",\n            \"category\",\n            \"registration_start\",\n            \"registration_end\",\n            \"cancel_deadline\",\n            \"optional_registrations\",\n            \"location\",\n            \"price\",\n            \"fine\",\n            \"num_participants\",\n            \"max_participants\",\n            \"no_registration_message\",\n            \"has_fields\",\n            \"food_event\",\n            \"maps_url\",\n            \"user_permissions\",\n            \"user_registration\",\n            \"organiser\",\n            \"slide\",\n            \"documents\",\n        )\n\n    description = CleanedHTMLSerializer()\n    organiser = MemberGroupSerializer()\n    user_registration = serializers.SerializerMethodField(\"_user_registration\")\n    num_participants = serializers.SerializerMethodField(\"_num_participants\")\n    maps_url = serializers.SerializerMethodField(\"_maps_url\")\n    price = serializers.DecimalField(max_digits=5, decimal_places=2)\n    fine = serializers.DecimalField(max_digits=5, decimal_places=2)\n    slide = SlideSerializer()\n    documents = DocumentSerializer(many=True)\n    user_permissions = serializers.SerializerMethodField(\"_user_permissions\")\n\n    def _user_registration(self, instance):\n        try:\n            if self.context[\"request\"].member:\n                reg = instance.eventregistration_set.get(\n                    member=self.context[\"request\"].member, date_cancelled=None\n                )\n                return EventRegistrationSerializer(\n                    reg,\n                    context=self.context,\n                    fields=(\"pk\", \"present\", \"queue_position\", \"date\", \"payment\"),\n                ).data\n        except EventRegistration.DoesNotExist:\n            pass\n        return None\n\n    def _num_participants(self, instance):\n        if (\n            instance.max_participants\n            and instance.participants.count() > instance.max_participants\n        ):\n            return instance.max_participants\n        return instance.participants.count()\n\n    def _user_permissions(self, instance):\n        member = self.context[\"request\"].member\n        return services.event_permissions(member, instance)\n\n    def _maps_url(self, instance):\n        return create_google_maps_url(instance.map_location, zoom=13, size=\"450x250\")\n", "path": "website/events/api/v2/serializers/event.py"}]}