Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug when creating a session using the REST API without specifying the users #885

Open
rossant opened this issue Nov 27, 2024 · 0 comments
Open

Comments

@rossant
Copy link
Contributor

rossant commented Nov 27, 2024

When creating a session using the REST API without specifying the users, this error occurs:

[Errno 500] /sessions: 'Traceback (most recent call last):
  File "/var/www/alyx-test/venv/lib/python3.8/site-packages/rest_framework/views.py", line 506, in dispatch
    response = handler(request, *args, **kwargs)
  File "/var/www/alyx-test/venv/lib/python3.8/site-packages/rest_framework/generics.py", line 246, in post
    return self.create(request, *args, **kwargs)
  File "/var/www/alyx-test/venv/lib/python3.8/site-packages/rest_framework/mixins.py", line 19, in create
    self.perform_create(serializer)
  File "/var/www/alyx-test/venv/lib/python3.8/site-packages/rest_framework/mixins.py", line 24, in perform_create
    serializer.save()
  File "/var/www/alyx-test/venv/lib/python3.8/site-packages/rest_framework/serializers.py", line 208, in save
    self.instance = self.create(validated_data)
  File "/var/www/alyx-test/venv/lib/python3.8/site-packages/rest_framework/serializers.py", line 1014, in create
    field.set(value)
  File "/var/www/alyx-test/venv/lib/python3.8/site-packages/django/db/models/fields/related_descriptors.py", line 1209, in set
    objs = tuple(objs)
TypeError: 'LabMember' object is not iterable
'

I wonder if the problem is not on this line where the default users should actually be a list with a single element [serializers.CurrentUserDefault()] instead of just serializers.CurrentUserDefault().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant