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

TypeError: Got a TypeError when calling ShiftingRequest.objects.create(). This may be because you have a... #1470

Closed
sentry-io bot opened this issue Jul 22, 2023 · 0 comments · Fixed by #1471
Assignees
Labels
P1 High priority; urgent

Comments

@sentry-io
Copy link

sentry-io bot commented Jul 22, 2023

Sentry Issue: CARE-RK

TypeError: ShiftingRequest() got unexpected keyword arguments: 'patient_category'
  File "rest_framework/serializers.py", line 962, in create
    instance = ModelClass._default_manager.create(**validated_data)
  File "django/db/models/manager.py", line 87, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "django/db/models/query.py", line 656, in create
    obj = self.model(**kwargs)
  File "django/db/models/base.py", line 567, in __init__
    raise TypeError(

TypeError: Got a `TypeError` when calling `ShiftingRequest.objects.create()`. This may be because you have a writable field on the serializer class that is not a valid argument to `ShiftingRequest.objects.create()`. You may need to make the field read-only, or override the ShiftingSerializer.create() method to handle this correctly.
Original exception was:
 Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/rest_framework/serializers.py", line 962, in create
    instance = ModelClass._default_manager.create(**validated_data)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/db/models/manager.py", line 87, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 656, in create
    obj = self.model(**kwargs)
          ^^^^^^^^^^^^^^^^^^^^
  File "/usr...
(9 additional frame(s) were not displayed)
...
  File "care/facility/api/serializers/shifting.py", line 413, in create
    return super().create(validated_data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 High priority; urgent
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant