When a Talk instance with an identical name is entered for multiple years and the talk is setup as a workshop, it crashes the workshop attendee registration.
To Reproduce
Register a Talk instance with a slug that already exists for an older event. Publish the Talk via the admin action, add the Talk to a talk slot and set the number of available seats. Login as an attendee and try to register for the workshop from the session grid -> Boom!
2023-03-15 09:13:30,787 ERROR Internal Server Error: /dev-day-2023/talk/<talk-slug>/reservation-confirmed/
Traceback (most recent call last):
File "/python-code/.venv/lib/python3.9/site-packages/django/core/handlers/exception.py", line 34, in inner
response = get_response(request)
File "/python-code/.venv/lib/python3.9/site-packages/django/core/handlers/base.py", line 115, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/python-code/.venv/lib/python3.9/site-packages/django/core/handlers/base.py", line 113, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/python-code/.venv/lib/python3.9/site-packages/django/views/generic/base.py", line 71, in view
return self.dispatch(request, *args, **kwargs)
File "/app/attendee/views.py", line 114, in dispatch
return super().dispatch(request, *args, **kwargs)
File "/python-code/.venv/lib/python3.9/site-packages/django/views/generic/base.py", line 97, in dispatch
return handler(request, *args, **kwargs)
File "/python-code/.venv/lib/python3.9/site-packages/django/views/generic/base.py", line 158, in get
context = self.get_context_data(**kwargs)
File "/app/talk/views.py", line 1261, in get_context_data
{"event": self.event, "talk": get_object_or_404(Talk, slug=kwargs["slug"])}
File "/python-code/.venv/lib/python3.9/site-packages/django/shortcuts.py", line 93, in get_object_or_404
return queryset.get(*args, **kwargs)
File "/python-code/.venv/lib/python3.9/site-packages/django/db/models/query.py", line 410, in get
raise self.model.MultipleObjectsReturned(
talk.models.Talk.MultipleObjectsReturned: get() returned more than one Talk -- it returned 2!
Expected behavior
The workshop registration works without issues.
Additional context
It is possible to change the slug of one of the conflicting Talk instances as a workaround.
Describe the bug
When a Talk instance with an identical name is entered for multiple years and the talk is setup as a workshop, it crashes the workshop attendee registration.
To Reproduce
Register a Talk instance with a slug that already exists for an older event. Publish the Talk via the admin action, add the Talk to a talk slot and set the number of available seats. Login as an attendee and try to register for the workshop from the session grid -> Boom!
Expected behavior
The workshop registration works without issues.
Additional context
It is possible to change the slug of one of the conflicting Talk instances as a workaround.