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

Unable to create consultation with bed #2376

Closed
sentry-io bot opened this issue Aug 21, 2024 · 0 comments · Fixed by #2375
Closed

Unable to create consultation with bed #2376

sentry-io bot opened this issue Aug 21, 2024 · 0 comments · Fixed by #2375
Assignees
Labels
bug Something isn't working

Comments

@sentry-io
Copy link

sentry-io bot commented Aug 21, 2024

Sentry Issue: CARE-F9T

TypeError: PatientConsultation() got unexpected keyword arguments: 'bed'
  File "rest_framework/serializers.py", line 989, 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 `PatientConsultation.objects.create()`. This may be because you have a writable field on the serializer class that is not a valid argument to `PatientConsultation.objects.create()`. You may need to make the field read-only, or override the PatientConsultationSerializer.create() method to handle this correctly.
Original exception was:
 Traceback (most recent call last):
  File "/venv/lib/python3.11/site-packages/rest_framework/serializers.py", line 989, in create
    instance = ModelClass._default_manager.create(**validated_data)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/venv/lib/python3.11/site-packages/django/db/models/manager.py", line 87, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/venv/lib/python3.11/site-packages/django/db/models/query.py", line 656, in create
    obj = self.model(**kwargs)
          ^^^^^^^^^^^^^^^^^^^^
  File "...
(13 additional frame(s) were not displayed)
...
  File "care/facility/api/viewsets/patient_consultation.py", line 115, in create
    return super().create(request, *args, **kwargs)
  File "care/facility/api/serializers/patient_consultation.py", line 402, in create
    consultation: PatientConsultation = super().create(validated_data)
@sentry-io sentry-io bot added the bug Something isn't working label Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant