You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.
Here is my example where PostSchema has self_url = '/author/{author_id}/posts/{id}/' and it raises the error below. This is not happening when I specify related_url='/authors/{author_id}' on the relationship
Traceback (most recent call last):
File "C:/Users/Joan/.PyCharmCE2019.1/config/scratches/scratch_6.py", line 50, in <module>
PostSchema().dump(post)
File "D:\Users\Joan\venvs\kii\lib\site-packages\marshmallow\schema.py", line 544, in dump
original_data=obj)
File "D:\Users\Joan\venvs\kii\lib\site-packages\marshmallow\schema.py", line 875, in _invoke_dump_processors
data=data, many=many, original_data=original_data)
File "D:\Users\Joan\venvs\kii\lib\site-packages\marshmallow\schema.py", line 976, in _invoke_processors
data = utils.if_none(processor(data, many), data)
File "D:\Users\Joan\venvs\kii\lib\site-packages\marshmallow_jsonapi\schema.py", line 128, in format_json_api_response
ret = self.format_items(data, many)
File "D:\Users\Joan\venvs\kii\lib\site-packages\marshmallow_jsonapi\schema.py", line 389, in format_items
return self.format_item(data)
File "D:\Users\Joan\venvs\kii\lib\site-packages\marshmallow_jsonapi\schema.py", line 376, in format_item
links = self.get_resource_links(item)
File "D:\Users\Joan\venvs\kii\lib\site-packages\marshmallow_jsonapi\schema.py", line 408, in get_resource_links
kwargs = resolve_params(item, self.opts.self_url_kwargs or {})
File "D:\Users\Joan\venvs\kii\lib\site-packages\marshmallow_jsonapi\utils.py", line 52, in resolve_params
'attribute of {obj!r}'.format(attr_name=attr_name, obj=obj),
AttributeError: 'author.id' is not a valid attribute of {'id': '1', 'author': {'links': {'self': '/posts/1/relationships/author', 'related': '/authors/94'}, 'data': {'type': 'users', 'id': '94'}}, 'title': 'Django is Omakase'}
Thank you for your time.
The text was updated successfully, but these errors were encountered:
Hi all,
Why am I not able to refer an attribute from a relationship in the self_url for a specific schema but I can in a Relationship.
Here is my example where PostSchema has self_url = '/author/{author_id}/posts/{id}/' and it raises the error below. This is not happening when I specify related_url='/authors/{author_id}' on the relationship
Thank you for your time.
The text was updated successfully, but these errors were encountered: