Links not added when creating a new profile by calling /api/v1/profiles/ endpoint in a POST request
I'm migrating our radio database via a python script to AURA. One step in this script the creation of "profiles" (formerly called "hosts") from hosts in our old system. Basically that works, only adding profile links trigger a server error (500).
Steps to Reproduce
- An example data set:
{
"biography": "My story, bla bla bla",
"email": "radiohosts@o94.at",
"imageId": 111,
"isActive": true,
"links": [
{
"typeId": 1,
"url": "http://www.mywebsite.at"
}
],
"name": "Max Mayr",
"ownerIds": [
123
]
}
- Send the JSON object in a
POST
request via/api/v1/profiles/
endpoint
Expected Result
If the new entry in table progam_profiles
has an ID of 10
(e.g.), a new entry like the following in program_profilelink
should have been created:
id | url | profile_id | type_id
----+-------------------------------+------------+---------
1 | http://www.mywebsite.at | 10 | 1
Actual Result
No entry is being created.
Logs & configuration
docker compose logs -f --tail=100 steering
:
steering | Traceback (most recent call last):
steering | File "/app/.cache/virtualenvs/steering-9TtSrW0h-py3.12/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
steering | response = get_response(request)
steering | ^^^^^^^^^^^^^^^^^^^^^
steering | File "/app/.cache/virtualenvs/steering-9TtSrW0h-py3.12/lib/python3.12/site-packages/django/core/handlers/base.py", line 197, in _get_response
steering | response = wrapped_callback(request, *callback_args, **callback_kwargs)
steering | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
steering | File "/app/.cache/virtualenvs/steering-9TtSrW0h-py3.12/lib/python3.12/site-packages/django/views/decorators/csrf.py", line 56, in wrapper_view
steering | return view_func(*args, **kwargs)
steering | ^^^^^^^^^^^^^^^^^^^^^^^^^^
steering | File "/app/.cache/virtualenvs/steering-9TtSrW0h-py3.12/lib/python3.12/site-packages/rest_framework/viewsets.py", line 124, in view
steering | return self.dispatch(request, *args, **kwargs)
steering | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
steering | File "/app/.cache/virtualenvs/steering-9TtSrW0h-py3.12/lib/python3.12/site-packages/rest_framework/views.py", line 509, in dispatch
steering | response = self.handle_exception(exc)
steering | ^^^^^^^^^^^^^^^^^^^^^^^^^^
steering | File "/app/.cache/virtualenvs/steering-9TtSrW0h-py3.12/lib/python3.12/site-packages/rest_framework/views.py", line 469, in handle_exception
steering | self.raise_uncaught_exception(exc)
steering | File "/app/.cache/virtualenvs/steering-9TtSrW0h-py3.12/lib/python3.12/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
steering | raise exc
steering | File "/app/.cache/virtualenvs/steering-9TtSrW0h-py3.12/lib/python3.12/site-packages/rest_framework/views.py", line 506, in dispatch
steering | response = handler(request, *args, **kwargs)
steering | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
steering | File "/app/program/views.py", line 1492, in create
steering | serializer.save()
steering | File "/app/.cache/virtualenvs/steering-9TtSrW0h-py3.12/lib/python3.12/site-packages/rest_framework/serializers.py", line 208, in save
steering | self.instance = self.create(validated_data)
steering | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
steering | File "/app/program/serializers.py", line 423, in create
steering | ProfileLink.objects.create(host=profile, **link_data)
steering | File "/app/.cache/virtualenvs/steering-9TtSrW0h-py3.12/lib/python3.12/site-packages/django/db/models/manager.py", line 87, in manager_method
steering | return getattr(self.get_queryset(), name)(*args, **kwargs)
steering | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
steering | File "/app/.cache/virtualenvs/steering-9TtSrW0h-py3.12/lib/python3.12/site-packages/django/db/models/query.py", line 656, in create
steering | obj = self.model(**kwargs)
steering | ^^^^^^^^^^^^^^^^^^^^
steering | File "/app/.cache/virtualenvs/steering-9TtSrW0h-py3.12/lib/python3.12/site-packages/django/db/models/base.py", line 567, in __init__
steering | raise TypeError(
steering | TypeError: ProfileLink() got unexpected keyword arguments: 'host'
steering | ERROR:django.request:Internal Server Error: /api/v1/profiles/
Environment
Migration script running in a python 3.11 venv on Debian 12.