We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
FieldError: Cannot resolve keyword 'registration' into field. Choices are: cancel_deadline, category, descrip...
Sentry Issue: [CONCREXIT-2Z](https://sentry.io/organizations/thalia/issues/1761243401/?referrer=github_integration)

```
FieldError: Cannot resolve keyword 'registration' into field. Choices are: cancel_deadline, category, description_en, description_nl, documents, end, eventregistration, fine, id, location_en, location_nl, map_location, max_participants, no_registration_message_en, no_registration_message_nl, organiser, organiser_id, pizzaevent, price, published, registration_end, registration_reminder, registration_reminder_id, registration_start, registrationinformationfield, send_cancel_email, slide, slide_id, start, start_reminde...
(14 additional frame(s) were not displayed)
...
  File "django/db/models/sql/query.py", line 1371, in _add_q
    child_clause, needed_inner = self._add_q(
  File "django/db/models/sql/query.py", line 1378, in _add_q
    child_clause, needed_inner = self.build_filter(
  File "django/db/models/sql/query.py", line 1251, in build_filter
    lookups, parts, reffed_expression = self.solve_lookup_type(arg)
  File "django/db/models/sql/query.py", line 1088, in solve_lookup_type
    _, field, _, lookup_parts = self.names_to_path(lookup_splitted, self.get_meta())
  File "django/db/models/sql/query.py", line 1483, in names_to_path
    raise FieldError("Cannot resolve keyword '%s' into field. "
```
FieldError: Cannot resolve keyword 'registration' into field. Choices are: cancel_deadline, category, descrip...
Sentry Issue: [CONCREXIT-2Z](https://sentry.io/organizations/thalia/issues/1761243401/?referrer=github_integration)

```
FieldError: Cannot resolve keyword 'registration' into field. Choices are: cancel_deadline, category, description_en, description_nl, documents, end, eventregistration, fine, id, location_en, location_nl, map_location, max_participants, no_registration_message_en, no_registration_message_nl, organiser, organiser_id, pizzaevent, price, published, registration_end, registration_reminder, registration_reminder_id, registration_start, registrationinformationfield, send_cancel_email, slide, slide_id, start, start_reminde...
(14 additional frame(s) were not displayed)
...
  File "django/db/models/sql/query.py", line 1371, in _add_q
    child_clause, needed_inner = self._add_q(
  File "django/db/models/sql/query.py", line 1378, in _add_q
    child_clause, needed_inner = self.build_filter(
  File "django/db/models/sql/query.py", line 1251, in build_filter
    lookups, parts, reffed_expression = self.solve_lookup_type(arg)
  File "django/db/models/sql/query.py", line 1088, in solve_lookup_type
    _, field, _, lookup_parts = self.names_to_path(lookup_splitted, self.get_meta())
  File "django/db/models/sql/query.py", line 1483, in names_to_path
    raise FieldError("Cannot resolve keyword '%s' into field. "
```

--- 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/events/feeds.py`
Content:
```
1 """The feeds defined by the events package"""
2 from django.conf import settings
3 from django.db.models.query_utils import Q
4 from django.urls import reverse
5 from django.utils.translation import activate
6 from django.utils.translation import gettext as _
7 from django_ical.views import ICalFeed
8 
9 from events.models import Event, FeedToken
10 
11 
12 class EventFeed(ICalFeed):
13     """Output an iCal feed containing all published events"""
14 
15     def __init__(self, lang="en"):
16         super().__init__()
17         self.lang = lang
18         self.user = None
19 
20     def __call__(self, request, *args, **kwargs):
21         if "u" in request.GET:
22             self.user = FeedToken.get_member(request.GET["u"])
23         else:
24             self.user = None
25 
26         return super().__call__(request, args, kwargs)
27 
28     def product_id(self):
29         return f"-//{settings.SITE_DOMAIN}//EventCalendar//{self.lang.upper()}"
30 
31     def file_name(self):
32         return "thalia_{}.ics".format(self.lang)
33 
34     def title(self):
35         activate(self.lang)
36         return _("Study Association Thalia event calendar")
37 
38     def items(self):
39         query = Q(published=True)
40 
41         if self.user:
42             query &= Q(registration_start__isnull=True) | (
43                 Q(registration__member=self.user) & Q(registration__date_cancelled=None)
44             )
45 
46         return Event.objects.filter(query).order_by("-start")
47 
48     def item_title(self, item):
49         return item.title
50 
51     def item_description(self, item):
52         return f'{item.description} <a href="' f'{self.item_link(item)}">Website</a>'
53 
54     def item_start_datetime(self, item):
55         return item.start
56 
57     def item_end_datetime(self, item):
58         return item.end
59 
60     def item_link(self, item):
61         return settings.BASE_URL + reverse("events:event", kwargs={"pk": item.id})
62 
63     def item_location(self, item):
64         return "{} - {}".format(item.location, item.map_location)
65
```

Path: `website/events/decorators.py`
Content:
```
1 """The decorators defined by the events package"""
2 from django.core.exceptions import PermissionDenied
3 
4 from events import services
5 from events.models import Event
6 
7 
8 def organiser_only(view_function):
9     """See OrganiserOnly"""
10     return OrganiserOnly(view_function)
11 
12 
13 class OrganiserOnly:
14     """
15     Decorator that denies access to the page if:
16     1. There is no `pk` or `registration` in the request
17     2. The specified event does not exist
18     3. The user is no organiser of the specified event
19     """
20 
21     def __init__(self, view_function):
22         self.view_function = view_function
23 
24     def __call__(self, request, *args, **kwargs):
25         event = None
26 
27         if "pk" in kwargs:
28             try:
29                 event = Event.objects.get(pk=kwargs.get("pk"))
30             except Event.DoesNotExist:
31                 pass
32         elif "registration" in kwargs:
33             try:
34                 event = Event.objects.get(registration__pk=kwargs.get("registration"))
35             except Event.DoesNotExist:
36                 pass
37 
38         if event and services.is_organiser(request.member, event):
39             return self.view_function(request, *args, **kwargs)
40 
41         raise PermissionDenied
42
```
--- 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/events/decorators.py b/website/events/decorators.py
--- a/website/events/decorators.py
+++ b/website/events/decorators.py
@@ -31,7 +31,9 @@
                 pass
         elif "registration" in kwargs:
             try:
-                event = Event.objects.get(registration__pk=kwargs.get("registration"))
+                event = Event.objects.get(
+                    eventregistration__pk=kwargs.get("registration")
+                )
             except Event.DoesNotExist:
                 pass
 
diff --git a/website/events/feeds.py b/website/events/feeds.py
--- a/website/events/feeds.py
+++ b/website/events/feeds.py
@@ -40,7 +40,8 @@
 
         if self.user:
             query &= Q(registration_start__isnull=True) | (
-                Q(registration__member=self.user) & Q(registration__date_cancelled=None)
+                Q(eventregistration__member=self.user)
+                & Q(eventregistration__date_cancelled=None)
             )
 
         return Event.objects.filter(query).order_by("-start")

{"golden_diff": "diff --git a/website/events/decorators.py b/website/events/decorators.py\n--- a/website/events/decorators.py\n+++ b/website/events/decorators.py\n@@ -31,7 +31,9 @@\n                 pass\n         elif \"registration\" in kwargs:\n             try:\n-                event = Event.objects.get(registration__pk=kwargs.get(\"registration\"))\n+                event = Event.objects.get(\n+                    eventregistration__pk=kwargs.get(\"registration\")\n+                )\n             except Event.DoesNotExist:\n                 pass\n \ndiff --git a/website/events/feeds.py b/website/events/feeds.py\n--- a/website/events/feeds.py\n+++ b/website/events/feeds.py\n@@ -40,7 +40,8 @@\n \n         if self.user:\n             query &= Q(registration_start__isnull=True) | (\n-                Q(registration__member=self.user) & Q(registration__date_cancelled=None)\n+                Q(eventregistration__member=self.user)\n+                & Q(eventregistration__date_cancelled=None)\n             )\n \n         return Event.objects.filter(query).order_by(\"-start\")\n", "issue": "FieldError: Cannot resolve keyword 'registration' into field. Choices are: cancel_deadline, category, descrip...\nSentry Issue: [CONCREXIT-2Z](https://sentry.io/organizations/thalia/issues/1761243401/?referrer=github_integration)\n\n```\nFieldError: Cannot resolve keyword 'registration' into field. Choices are: cancel_deadline, category, description_en, description_nl, documents, end, eventregistration, fine, id, location_en, location_nl, map_location, max_participants, no_registration_message_en, no_registration_message_nl, organiser, organiser_id, pizzaevent, price, published, registration_end, registration_reminder, registration_reminder_id, registration_start, registrationinformationfield, send_cancel_email, slide, slide_id, start, start_reminde...\n(14 additional frame(s) were not displayed)\n...\n  File \"django/db/models/sql/query.py\", line 1371, in _add_q\n    child_clause, needed_inner = self._add_q(\n  File \"django/db/models/sql/query.py\", line 1378, in _add_q\n    child_clause, needed_inner = self.build_filter(\n  File \"django/db/models/sql/query.py\", line 1251, in build_filter\n    lookups, parts, reffed_expression = self.solve_lookup_type(arg)\n  File \"django/db/models/sql/query.py\", line 1088, in solve_lookup_type\n    _, field, _, lookup_parts = self.names_to_path(lookup_splitted, self.get_meta())\n  File \"django/db/models/sql/query.py\", line 1483, in names_to_path\n    raise FieldError(\"Cannot resolve keyword '%s' into field. \"\n```\nFieldError: Cannot resolve keyword 'registration' into field. Choices are: cancel_deadline, category, descrip...\nSentry Issue: [CONCREXIT-2Z](https://sentry.io/organizations/thalia/issues/1761243401/?referrer=github_integration)\n\n```\nFieldError: Cannot resolve keyword 'registration' into field. Choices are: cancel_deadline, category, description_en, description_nl, documents, end, eventregistration, fine, id, location_en, location_nl, map_location, max_participants, no_registration_message_en, no_registration_message_nl, organiser, organiser_id, pizzaevent, price, published, registration_end, registration_reminder, registration_reminder_id, registration_start, registrationinformationfield, send_cancel_email, slide, slide_id, start, start_reminde...\n(14 additional frame(s) were not displayed)\n...\n  File \"django/db/models/sql/query.py\", line 1371, in _add_q\n    child_clause, needed_inner = self._add_q(\n  File \"django/db/models/sql/query.py\", line 1378, in _add_q\n    child_clause, needed_inner = self.build_filter(\n  File \"django/db/models/sql/query.py\", line 1251, in build_filter\n    lookups, parts, reffed_expression = self.solve_lookup_type(arg)\n  File \"django/db/models/sql/query.py\", line 1088, in solve_lookup_type\n    _, field, _, lookup_parts = self.names_to_path(lookup_splitted, self.get_meta())\n  File \"django/db/models/sql/query.py\", line 1483, in names_to_path\n    raise FieldError(\"Cannot resolve keyword '%s' into field. \"\n```\n", "before_files": [{"content": "\"\"\"The feeds defined by the events package\"\"\"\nfrom django.conf import settings\nfrom django.db.models.query_utils import Q\nfrom django.urls import reverse\nfrom django.utils.translation import activate\nfrom django.utils.translation import gettext as _\nfrom django_ical.views import ICalFeed\n\nfrom events.models import Event, FeedToken\n\n\nclass EventFeed(ICalFeed):\n    \"\"\"Output an iCal feed containing all published events\"\"\"\n\n    def __init__(self, lang=\"en\"):\n        super().__init__()\n        self.lang = lang\n        self.user = None\n\n    def __call__(self, request, *args, **kwargs):\n        if \"u\" in request.GET:\n            self.user = FeedToken.get_member(request.GET[\"u\"])\n        else:\n            self.user = None\n\n        return super().__call__(request, args, kwargs)\n\n    def product_id(self):\n        return f\"-//{settings.SITE_DOMAIN}//EventCalendar//{self.lang.upper()}\"\n\n    def file_name(self):\n        return \"thalia_{}.ics\".format(self.lang)\n\n    def title(self):\n        activate(self.lang)\n        return _(\"Study Association Thalia event calendar\")\n\n    def items(self):\n        query = Q(published=True)\n\n        if self.user:\n            query &= Q(registration_start__isnull=True) | (\n                Q(registration__member=self.user) & Q(registration__date_cancelled=None)\n            )\n\n        return Event.objects.filter(query).order_by(\"-start\")\n\n    def item_title(self, item):\n        return item.title\n\n    def item_description(self, item):\n        return f'{item.description} <a href=\"' f'{self.item_link(item)}\">Website</a>'\n\n    def item_start_datetime(self, item):\n        return item.start\n\n    def item_end_datetime(self, item):\n        return item.end\n\n    def item_link(self, item):\n        return settings.BASE_URL + reverse(\"events:event\", kwargs={\"pk\": item.id})\n\n    def item_location(self, item):\n        return \"{} - {}\".format(item.location, item.map_location)\n", "path": "website/events/feeds.py"}, {"content": "\"\"\"The decorators defined by the events package\"\"\"\nfrom django.core.exceptions import PermissionDenied\n\nfrom events import services\nfrom events.models import Event\n\n\ndef organiser_only(view_function):\n    \"\"\"See OrganiserOnly\"\"\"\n    return OrganiserOnly(view_function)\n\n\nclass OrganiserOnly:\n    \"\"\"\n    Decorator that denies access to the page if:\n    1. There is no `pk` or `registration` in the request\n    2. The specified event does not exist\n    3. The user is no organiser of the specified event\n    \"\"\"\n\n    def __init__(self, view_function):\n        self.view_function = view_function\n\n    def __call__(self, request, *args, **kwargs):\n        event = None\n\n        if \"pk\" in kwargs:\n            try:\n                event = Event.objects.get(pk=kwargs.get(\"pk\"))\n            except Event.DoesNotExist:\n                pass\n        elif \"registration\" in kwargs:\n            try:\n                event = Event.objects.get(registration__pk=kwargs.get(\"registration\"))\n            except Event.DoesNotExist:\n                pass\n\n        if event and services.is_organiser(request.member, event):\n            return self.view_function(request, *args, **kwargs)\n\n        raise PermissionDenied\n", "path": "website/events/decorators.py"}], "after_files": [{"content": "\"\"\"The feeds defined by the events package\"\"\"\nfrom django.conf import settings\nfrom django.db.models.query_utils import Q\nfrom django.urls import reverse\nfrom django.utils.translation import activate\nfrom django.utils.translation import gettext as _\nfrom django_ical.views import ICalFeed\n\nfrom events.models import Event, FeedToken\n\n\nclass EventFeed(ICalFeed):\n    \"\"\"Output an iCal feed containing all published events\"\"\"\n\n    def __init__(self, lang=\"en\"):\n        super().__init__()\n        self.lang = lang\n        self.user = None\n\n    def __call__(self, request, *args, **kwargs):\n        if \"u\" in request.GET:\n            self.user = FeedToken.get_member(request.GET[\"u\"])\n        else:\n            self.user = None\n\n        return super().__call__(request, args, kwargs)\n\n    def product_id(self):\n        return f\"-//{settings.SITE_DOMAIN}//EventCalendar//{self.lang.upper()}\"\n\n    def file_name(self):\n        return \"thalia_{}.ics\".format(self.lang)\n\n    def title(self):\n        activate(self.lang)\n        return _(\"Study Association Thalia event calendar\")\n\n    def items(self):\n        query = Q(published=True)\n\n        if self.user:\n            query &= Q(registration_start__isnull=True) | (\n                Q(eventregistration__member=self.user)\n                & Q(eventregistration__date_cancelled=None)\n            )\n\n        return Event.objects.filter(query).order_by(\"-start\")\n\n    def item_title(self, item):\n        return item.title\n\n    def item_description(self, item):\n        return f'{item.description} <a href=\"' f'{self.item_link(item)}\">Website</a>'\n\n    def item_start_datetime(self, item):\n        return item.start\n\n    def item_end_datetime(self, item):\n        return item.end\n\n    def item_link(self, item):\n        return settings.BASE_URL + reverse(\"events:event\", kwargs={\"pk\": item.id})\n\n    def item_location(self, item):\n        return \"{} - {}\".format(item.location, item.map_location)\n", "path": "website/events/feeds.py"}, {"content": "\"\"\"The decorators defined by the events package\"\"\"\nfrom django.core.exceptions import PermissionDenied\n\nfrom events import services\nfrom events.models import Event\n\n\ndef organiser_only(view_function):\n    \"\"\"See OrganiserOnly\"\"\"\n    return OrganiserOnly(view_function)\n\n\nclass OrganiserOnly:\n    \"\"\"\n    Decorator that denies access to the page if:\n    1. There is no `pk` or `registration` in the request\n    2. The specified event does not exist\n    3. The user is no organiser of the specified event\n    \"\"\"\n\n    def __init__(self, view_function):\n        self.view_function = view_function\n\n    def __call__(self, request, *args, **kwargs):\n        event = None\n\n        if \"pk\" in kwargs:\n            try:\n                event = Event.objects.get(pk=kwargs.get(\"pk\"))\n            except Event.DoesNotExist:\n                pass\n        elif \"registration\" in kwargs:\n            try:\n                event = Event.objects.get(\n                    eventregistration__pk=kwargs.get(\"registration\")\n                )\n            except Event.DoesNotExist:\n                pass\n\n        if event and services.is_organiser(request.member, event):\n            return self.view_function(request, *args, **kwargs)\n\n        raise PermissionDenied\n", "path": "website/events/decorators.py"}]}