We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Re-add rudamentary version of organisers to the event list API endpoint
<!--

Please add the appropriate label for what change should be made:
docs: changes to the documentation)
refactor: refactoring production code, eg. renaming a variable or rewriting a function
test: adding missing tests, refactoring tests; no production code change
chore: updating poetry etc; no production code change

-->

### Describe the change
Add a id-name based list of event organisers to the event list API endpoint.

### Motivation
Because it would make me and my Reaxit PR very happy.

### Current implementation
It got removed :(

### Suggested implementation
Just do it Kappa


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `website/activemembers/api/v2/serializers/member_group.py`
Content:
```
1 from rest_framework import serializers
2 
3 from activemembers.api.v2.serializers.member_group_membership import (
4     MemberGroupMembershipSerializer,
5 )
6 from activemembers.models import MemberGroup
7 from thaliawebsite.api.v2.serializers import ThumbnailSerializer
8 from thaliawebsite.api.v2.serializers.cleaned_model_serializer import (
9     CleanedModelSerializer,
10 )
11 
12 
13 class MemberGroupSerializer(CleanedModelSerializer):
14     """API serializer for member groups."""
15 
16     def __init__(self, *args, **kwargs):
17         super().__init__(*args, **kwargs)
18 
19         if "get_memberships" not in self.context and "members" in self.fields:
20             self.fields.pop("members")
21 
22     class Meta:
23         """Meta class for the serializer."""
24 
25         model = MemberGroup
26         fields = (
27             "pk",
28             "name",
29             "type",
30             "description",
31             "since",
32             "until",
33             "contact_address",
34             "photo",
35             "members",
36         )
37 
38     members = serializers.SerializerMethodField("_members")
39     type = serializers.SerializerMethodField("_type")
40     photo = ThumbnailSerializer(placeholder="activemembers/images/placeholder.png")
41 
42     def _members(self, instance):
43         memberships = self.context["get_memberships"](instance).prefetch_related(
44             "member__membergroupmembership_set"
45         )
46         return MemberGroupMembershipSerializer(
47             many=True, context=self.context
48         ).to_representation(memberships)
49 
50     def _type(self, instance):
51         if hasattr(instance, "board"):
52             return "board"
53         if hasattr(instance, "committee"):
54             return "committee"
55         if hasattr(instance, "society"):
56             return "society"
57         return None
58 
59 
60 class MemberGroupListSerializer(MemberGroupSerializer):
61     class Meta:
62         """Meta class for the serializer."""
63 
64         model = MemberGroup
65         fields = (
66             "pk",
67             "name",
68             "type",
69             "description",
70             "since",
71             "until",
72             "contact_address",
73             "photo",
74         )
75
```

Path: `website/events/api/v2/serializers/event.py`
Content:
```
1 from rest_framework import serializers
2 from rest_framework.reverse import reverse
3 
4 from activemembers.api.v2.serializers.member_group import MemberGroupSerializer
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
9 from payments.api.v2.serializers.payment_amount import PaymentAmountSerializer
10 from thaliawebsite.api.v2.serializers import CleanedHTMLSerializer
11 from thaliawebsite.api.v2.serializers.cleaned_model_serializer import (
12     CleanedModelSerializer,
13 )
14 from utils.snippets import create_google_maps_url
15 
16 
17 class EventSerializer(CleanedModelSerializer):
18     """Serializer for events."""
19 
20     class Meta:
21         model = Event
22         fields = (
23             "pk",
24             "slug",
25             "url",
26             "title",
27             "description",
28             "caption",
29             "start",
30             "end",
31             "category",
32             "registration_start",
33             "registration_end",
34             "cancel_deadline",
35             "optional_registrations",
36             "location",
37             "price",
38             "fine",
39             "num_participants",
40             "max_participants",
41             "no_registration_message",
42             "registration_status",
43             "cancel_too_late_message",
44             "has_fields",
45             "food_event",
46             "maps_url",
47             "user_permissions",
48             "user_registration",
49             "organisers",
50             "documents",
51         )
52 
53     description = CleanedHTMLSerializer()
54     organisers = MemberGroupSerializer(many=True)
55     user_registration = serializers.SerializerMethodField("_user_registration")
56     num_participants = serializers.SerializerMethodField("_num_participants")
57     maps_url = serializers.SerializerMethodField("_maps_url")
58     registration_status = serializers.SerializerMethodField("_registration_status")
59     price = PaymentAmountSerializer()
60     fine = PaymentAmountSerializer()
61     documents = DocumentSerializer(many=True)
62     user_permissions = serializers.SerializerMethodField("_user_permissions")
63     url = serializers.SerializerMethodField("_url")
64 
65     def _user_registration(self, instance: Event):
66         if self.context["request"].member and len(instance.member_registration) > 0:
67             registration = instance.member_registration[-1]
68             return EventRegistrationSerializer(
69                 registration,
70                 context=self.context,
71                 fields=(
72                     "pk",
73                     "present",
74                     "queue_position",
75                     "is_cancelled",
76                     "is_late_cancellation",
77                     "date",
78                     "payment",
79                 ),
80             ).data
81         return None
82 
83     def _registration_status(self, instance: Event):
84         if self.context["request"].member and len(instance.member_registration) > 0:
85             registration = instance.member_registration[-1]
86         else:
87             registration = None
88         status = services.registration_status(
89             instance, registration, self.context["request"].member
90         )
91         cancel_status = services.cancel_status(instance, registration)
92 
93         status_str = services.registration_status_string(status, instance, registration)
94         cancel_str = services.cancel_info_string(instance, cancel_status, status)
95         if services.show_cancel_status(status) and cancel_str != "":
96             return f"{status_str} {cancel_str}"
97         return f"{status_str}"
98 
99     def _num_participants(self, instance: Event):
100         if instance.max_participants:
101             return min(instance.participant_count, instance.max_participants)
102         return instance.participant_count
103 
104     def _user_permissions(self, instance):
105         member = self.context["request"].member
106         return services.event_permissions(member, instance, registration_prefetch=True)
107 
108     def _url(self, instance: Event):
109         if instance.slug is None:
110             return reverse(
111                 "events:event",
112                 kwargs={"pk": instance.pk},
113                 request=self.context["request"],
114             )
115         return reverse(
116             "events:event",
117             kwargs={"slug": instance.slug},
118             request=self.context["request"],
119         )
120 
121     def _maps_url(self, instance):
122         return create_google_maps_url(instance.map_location, zoom=13, size="450x250")
123 
124 
125 class EventListSerializer(EventSerializer):
126     class Meta:
127         model = Event
128         fields = (
129             "pk",
130             "slug",
131             "url",
132             "title",
133             "description",
134             "caption",
135             "start",
136             "end",
137             "category",
138             "registration_start",
139             "registration_end",
140             "cancel_deadline",
141             "optional_registrations",
142             "location",
143             "price",
144             "fine",
145             "num_participants",
146             "max_participants",
147             "no_registration_message",
148             "registration_status",
149             "cancel_too_late_message",
150             "has_fields",
151             "food_event",
152             "maps_url",
153             "user_permissions",
154             "user_registration",
155             "documents",
156         )
157
```
--- 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/website/activemembers/api/v2/serializers/member_group.py b/website/activemembers/api/v2/serializers/member_group.py
--- a/website/activemembers/api/v2/serializers/member_group.py
+++ b/website/activemembers/api/v2/serializers/member_group.py
@@ -72,3 +72,16 @@
             "contact_address",
             "photo",
         )
+
+
+class MemberGroupShortSerializer(MemberGroupListSerializer):
+    class Meta:
+        model = MemberGroup
+        fields = (
+            "pk",
+            "name",
+            "type",
+            "since",
+            "until",
+            "contact_address",
+        )
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
@@ -1,7 +1,10 @@
 from rest_framework import serializers
 from rest_framework.reverse import reverse
 
-from activemembers.api.v2.serializers.member_group import MemberGroupSerializer
+from activemembers.api.v2.serializers.member_group import (
+    MemberGroupSerializer,
+    MemberGroupShortSerializer,
+)
 from documents.api.v2.serializers.document import DocumentSerializer
 from events import services
 from events.api.v2.serializers.event_registration import EventRegistrationSerializer
@@ -123,34 +126,4 @@
 
 
 class EventListSerializer(EventSerializer):
-    class Meta:
-        model = Event
-        fields = (
-            "pk",
-            "slug",
-            "url",
-            "title",
-            "description",
-            "caption",
-            "start",
-            "end",
-            "category",
-            "registration_start",
-            "registration_end",
-            "cancel_deadline",
-            "optional_registrations",
-            "location",
-            "price",
-            "fine",
-            "num_participants",
-            "max_participants",
-            "no_registration_message",
-            "registration_status",
-            "cancel_too_late_message",
-            "has_fields",
-            "food_event",
-            "maps_url",
-            "user_permissions",
-            "user_registration",
-            "documents",
-        )
+    organisers = MemberGroupShortSerializer(many=True)

{"golden_diff": "diff --git a/website/activemembers/api/v2/serializers/member_group.py b/website/activemembers/api/v2/serializers/member_group.py\n--- a/website/activemembers/api/v2/serializers/member_group.py\n+++ b/website/activemembers/api/v2/serializers/member_group.py\n@@ -72,3 +72,16 @@\n             \"contact_address\",\n             \"photo\",\n         )\n+\n+\n+class MemberGroupShortSerializer(MemberGroupListSerializer):\n+    class Meta:\n+        model = MemberGroup\n+        fields = (\n+            \"pk\",\n+            \"name\",\n+            \"type\",\n+            \"since\",\n+            \"until\",\n+            \"contact_address\",\n+        )\ndiff --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@@ -1,7 +1,10 @@\n from rest_framework import serializers\n from rest_framework.reverse import reverse\n \n-from activemembers.api.v2.serializers.member_group import MemberGroupSerializer\n+from activemembers.api.v2.serializers.member_group import (\n+    MemberGroupSerializer,\n+    MemberGroupShortSerializer,\n+)\n from documents.api.v2.serializers.document import DocumentSerializer\n from events import services\n from events.api.v2.serializers.event_registration import EventRegistrationSerializer\n@@ -123,34 +126,4 @@\n \n \n class EventListSerializer(EventSerializer):\n-    class Meta:\n-        model = Event\n-        fields = (\n-            \"pk\",\n-            \"slug\",\n-            \"url\",\n-            \"title\",\n-            \"description\",\n-            \"caption\",\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-            \"registration_status\",\n-            \"cancel_too_late_message\",\n-            \"has_fields\",\n-            \"food_event\",\n-            \"maps_url\",\n-            \"user_permissions\",\n-            \"user_registration\",\n-            \"documents\",\n-        )\n+    organisers = MemberGroupShortSerializer(many=True)\n", "issue": "Re-add rudamentary version of organisers to the event list API endpoint\n<!--\r\n\r\nPlease add the appropriate label for what change should be made:\r\ndocs: changes to the documentation)\r\nrefactor: refactoring production code, eg. renaming a variable or rewriting a function\r\ntest: adding missing tests, refactoring tests; no production code change\r\nchore: updating poetry etc; no production code change\r\n\r\n-->\r\n\r\n### Describe the change\r\nAdd a id-name based list of event organisers to the event list API endpoint.\r\n\r\n### Motivation\r\nBecause it would make me and my Reaxit PR very happy.\r\n\r\n### Current implementation\r\nIt got removed :(\r\n\r\n### Suggested implementation\r\nJust do it Kappa\r\n\n", "before_files": [{"content": "from rest_framework import serializers\n\nfrom activemembers.api.v2.serializers.member_group_membership import (\n    MemberGroupMembershipSerializer,\n)\nfrom activemembers.models import MemberGroup\nfrom thaliawebsite.api.v2.serializers import ThumbnailSerializer\nfrom thaliawebsite.api.v2.serializers.cleaned_model_serializer import (\n    CleanedModelSerializer,\n)\n\n\nclass MemberGroupSerializer(CleanedModelSerializer):\n    \"\"\"API serializer for member groups.\"\"\"\n\n    def __init__(self, *args, **kwargs):\n        super().__init__(*args, **kwargs)\n\n        if \"get_memberships\" not in self.context and \"members\" in self.fields:\n            self.fields.pop(\"members\")\n\n    class Meta:\n        \"\"\"Meta class for the serializer.\"\"\"\n\n        model = MemberGroup\n        fields = (\n            \"pk\",\n            \"name\",\n            \"type\",\n            \"description\",\n            \"since\",\n            \"until\",\n            \"contact_address\",\n            \"photo\",\n            \"members\",\n        )\n\n    members = serializers.SerializerMethodField(\"_members\")\n    type = serializers.SerializerMethodField(\"_type\")\n    photo = ThumbnailSerializer(placeholder=\"activemembers/images/placeholder.png\")\n\n    def _members(self, instance):\n        memberships = self.context[\"get_memberships\"](instance).prefetch_related(\n            \"member__membergroupmembership_set\"\n        )\n        return MemberGroupMembershipSerializer(\n            many=True, context=self.context\n        ).to_representation(memberships)\n\n    def _type(self, instance):\n        if hasattr(instance, \"board\"):\n            return \"board\"\n        if hasattr(instance, \"committee\"):\n            return \"committee\"\n        if hasattr(instance, \"society\"):\n            return \"society\"\n        return None\n\n\nclass MemberGroupListSerializer(MemberGroupSerializer):\n    class Meta:\n        \"\"\"Meta class for the serializer.\"\"\"\n\n        model = MemberGroup\n        fields = (\n            \"pk\",\n            \"name\",\n            \"type\",\n            \"description\",\n            \"since\",\n            \"until\",\n            \"contact_address\",\n            \"photo\",\n        )\n", "path": "website/activemembers/api/v2/serializers/member_group.py"}, {"content": "from rest_framework import serializers\nfrom rest_framework.reverse import reverse\n\nfrom activemembers.api.v2.serializers.member_group import MemberGroupSerializer\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\nfrom payments.api.v2.serializers.payment_amount import PaymentAmountSerializer\nfrom thaliawebsite.api.v2.serializers import CleanedHTMLSerializer\nfrom thaliawebsite.api.v2.serializers.cleaned_model_serializer import (\n    CleanedModelSerializer,\n)\nfrom utils.snippets import create_google_maps_url\n\n\nclass EventSerializer(CleanedModelSerializer):\n    \"\"\"Serializer for events.\"\"\"\n\n    class Meta:\n        model = Event\n        fields = (\n            \"pk\",\n            \"slug\",\n            \"url\",\n            \"title\",\n            \"description\",\n            \"caption\",\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            \"registration_status\",\n            \"cancel_too_late_message\",\n            \"has_fields\",\n            \"food_event\",\n            \"maps_url\",\n            \"user_permissions\",\n            \"user_registration\",\n            \"organisers\",\n            \"documents\",\n        )\n\n    description = CleanedHTMLSerializer()\n    organisers = MemberGroupSerializer(many=True)\n    user_registration = serializers.SerializerMethodField(\"_user_registration\")\n    num_participants = serializers.SerializerMethodField(\"_num_participants\")\n    maps_url = serializers.SerializerMethodField(\"_maps_url\")\n    registration_status = serializers.SerializerMethodField(\"_registration_status\")\n    price = PaymentAmountSerializer()\n    fine = PaymentAmountSerializer()\n    documents = DocumentSerializer(many=True)\n    user_permissions = serializers.SerializerMethodField(\"_user_permissions\")\n    url = serializers.SerializerMethodField(\"_url\")\n\n    def _user_registration(self, instance: Event):\n        if self.context[\"request\"].member and len(instance.member_registration) > 0:\n            registration = instance.member_registration[-1]\n            return EventRegistrationSerializer(\n                registration,\n                context=self.context,\n                fields=(\n                    \"pk\",\n                    \"present\",\n                    \"queue_position\",\n                    \"is_cancelled\",\n                    \"is_late_cancellation\",\n                    \"date\",\n                    \"payment\",\n                ),\n            ).data\n        return None\n\n    def _registration_status(self, instance: Event):\n        if self.context[\"request\"].member and len(instance.member_registration) > 0:\n            registration = instance.member_registration[-1]\n        else:\n            registration = None\n        status = services.registration_status(\n            instance, registration, self.context[\"request\"].member\n        )\n        cancel_status = services.cancel_status(instance, registration)\n\n        status_str = services.registration_status_string(status, instance, registration)\n        cancel_str = services.cancel_info_string(instance, cancel_status, status)\n        if services.show_cancel_status(status) and cancel_str != \"\":\n            return f\"{status_str} {cancel_str}\"\n        return f\"{status_str}\"\n\n    def _num_participants(self, instance: Event):\n        if instance.max_participants:\n            return min(instance.participant_count, instance.max_participants)\n        return instance.participant_count\n\n    def _user_permissions(self, instance):\n        member = self.context[\"request\"].member\n        return services.event_permissions(member, instance, registration_prefetch=True)\n\n    def _url(self, instance: Event):\n        if instance.slug is None:\n            return reverse(\n                \"events:event\",\n                kwargs={\"pk\": instance.pk},\n                request=self.context[\"request\"],\n            )\n        return reverse(\n            \"events:event\",\n            kwargs={\"slug\": instance.slug},\n            request=self.context[\"request\"],\n        )\n\n    def _maps_url(self, instance):\n        return create_google_maps_url(instance.map_location, zoom=13, size=\"450x250\")\n\n\nclass EventListSerializer(EventSerializer):\n    class Meta:\n        model = Event\n        fields = (\n            \"pk\",\n            \"slug\",\n            \"url\",\n            \"title\",\n            \"description\",\n            \"caption\",\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            \"registration_status\",\n            \"cancel_too_late_message\",\n            \"has_fields\",\n            \"food_event\",\n            \"maps_url\",\n            \"user_permissions\",\n            \"user_registration\",\n            \"documents\",\n        )\n", "path": "website/events/api/v2/serializers/event.py"}], "after_files": [{"content": "from rest_framework import serializers\n\nfrom activemembers.api.v2.serializers.member_group_membership import (\n    MemberGroupMembershipSerializer,\n)\nfrom activemembers.models import MemberGroup\nfrom thaliawebsite.api.v2.serializers import ThumbnailSerializer\nfrom thaliawebsite.api.v2.serializers.cleaned_model_serializer import (\n    CleanedModelSerializer,\n)\n\n\nclass MemberGroupSerializer(CleanedModelSerializer):\n    \"\"\"API serializer for member groups.\"\"\"\n\n    def __init__(self, *args, **kwargs):\n        super().__init__(*args, **kwargs)\n\n        if \"get_memberships\" not in self.context and \"members\" in self.fields:\n            self.fields.pop(\"members\")\n\n    class Meta:\n        \"\"\"Meta class for the serializer.\"\"\"\n\n        model = MemberGroup\n        fields = (\n            \"pk\",\n            \"name\",\n            \"type\",\n            \"description\",\n            \"since\",\n            \"until\",\n            \"contact_address\",\n            \"photo\",\n            \"members\",\n        )\n\n    members = serializers.SerializerMethodField(\"_members\")\n    type = serializers.SerializerMethodField(\"_type\")\n    photo = ThumbnailSerializer(placeholder=\"activemembers/images/placeholder.png\")\n\n    def _members(self, instance):\n        memberships = self.context[\"get_memberships\"](instance).prefetch_related(\n            \"member__membergroupmembership_set\"\n        )\n        return MemberGroupMembershipSerializer(\n            many=True, context=self.context\n        ).to_representation(memberships)\n\n    def _type(self, instance):\n        if hasattr(instance, \"board\"):\n            return \"board\"\n        if hasattr(instance, \"committee\"):\n            return \"committee\"\n        if hasattr(instance, \"society\"):\n            return \"society\"\n        return None\n\n\nclass MemberGroupListSerializer(MemberGroupSerializer):\n    class Meta:\n        \"\"\"Meta class for the serializer.\"\"\"\n\n        model = MemberGroup\n        fields = (\n            \"pk\",\n            \"name\",\n            \"type\",\n            \"description\",\n            \"since\",\n            \"until\",\n            \"contact_address\",\n            \"photo\",\n        )\n\n\nclass MemberGroupShortSerializer(MemberGroupListSerializer):\n    class Meta:\n        model = MemberGroup\n        fields = (\n            \"pk\",\n            \"name\",\n            \"type\",\n            \"since\",\n            \"until\",\n            \"contact_address\",\n        )\n", "path": "website/activemembers/api/v2/serializers/member_group.py"}, {"content": "from rest_framework import serializers\nfrom rest_framework.reverse import reverse\n\nfrom activemembers.api.v2.serializers.member_group import (\n    MemberGroupSerializer,\n    MemberGroupShortSerializer,\n)\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\nfrom payments.api.v2.serializers.payment_amount import PaymentAmountSerializer\nfrom thaliawebsite.api.v2.serializers import CleanedHTMLSerializer\nfrom thaliawebsite.api.v2.serializers.cleaned_model_serializer import (\n    CleanedModelSerializer,\n)\nfrom utils.snippets import create_google_maps_url\n\n\nclass EventSerializer(CleanedModelSerializer):\n    \"\"\"Serializer for events.\"\"\"\n\n    class Meta:\n        model = Event\n        fields = (\n            \"pk\",\n            \"slug\",\n            \"url\",\n            \"title\",\n            \"description\",\n            \"caption\",\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            \"registration_status\",\n            \"cancel_too_late_message\",\n            \"has_fields\",\n            \"food_event\",\n            \"maps_url\",\n            \"user_permissions\",\n            \"user_registration\",\n            \"organisers\",\n            \"documents\",\n        )\n\n    description = CleanedHTMLSerializer()\n    organisers = MemberGroupSerializer(many=True)\n    user_registration = serializers.SerializerMethodField(\"_user_registration\")\n    num_participants = serializers.SerializerMethodField(\"_num_participants\")\n    maps_url = serializers.SerializerMethodField(\"_maps_url\")\n    registration_status = serializers.SerializerMethodField(\"_registration_status\")\n    price = PaymentAmountSerializer()\n    fine = PaymentAmountSerializer()\n    documents = DocumentSerializer(many=True)\n    user_permissions = serializers.SerializerMethodField(\"_user_permissions\")\n    url = serializers.SerializerMethodField(\"_url\")\n\n    def _user_registration(self, instance: Event):\n        if self.context[\"request\"].member and len(instance.member_registration) > 0:\n            registration = instance.member_registration[-1]\n            return EventRegistrationSerializer(\n                registration,\n                context=self.context,\n                fields=(\n                    \"pk\",\n                    \"present\",\n                    \"queue_position\",\n                    \"is_cancelled\",\n                    \"is_late_cancellation\",\n                    \"date\",\n                    \"payment\",\n                ),\n            ).data\n        return None\n\n    def _registration_status(self, instance: Event):\n        if self.context[\"request\"].member and len(instance.member_registration) > 0:\n            registration = instance.member_registration[-1]\n        else:\n            registration = None\n        status = services.registration_status(\n            instance, registration, self.context[\"request\"].member\n        )\n        cancel_status = services.cancel_status(instance, registration)\n\n        status_str = services.registration_status_string(status, instance, registration)\n        cancel_str = services.cancel_info_string(instance, cancel_status, status)\n        if services.show_cancel_status(status) and cancel_str != \"\":\n            return f\"{status_str} {cancel_str}\"\n        return f\"{status_str}\"\n\n    def _num_participants(self, instance: Event):\n        if instance.max_participants:\n            return min(instance.participant_count, instance.max_participants)\n        return instance.participant_count\n\n    def _user_permissions(self, instance):\n        member = self.context[\"request\"].member\n        return services.event_permissions(member, instance, registration_prefetch=True)\n\n    def _url(self, instance: Event):\n        if instance.slug is None:\n            return reverse(\n                \"events:event\",\n                kwargs={\"pk\": instance.pk},\n                request=self.context[\"request\"],\n            )\n        return reverse(\n            \"events:event\",\n            kwargs={\"slug\": instance.slug},\n            request=self.context[\"request\"],\n        )\n\n    def _maps_url(self, instance):\n        return create_google_maps_url(instance.map_location, zoom=13, size=\"450x250\")\n\n\nclass EventListSerializer(EventSerializer):\n    organisers = MemberGroupShortSerializer(many=True)\n", "path": "website/events/api/v2/serializers/event.py"}]}