Repository: svthalia/concrexit

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. "
```


Discussion:

Resolving patch:
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 @@ def __call__(self, request, *args, **kwargs):
                 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 @@ def items(self):
 
         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")


Test patch: