-
Notifications
You must be signed in to change notification settings - Fork 301
get_related_resource_type returns parent model name #77
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
Comments
Pull latest version from github, I fixed that I think in some commit. |
Thanks for the quick reply! I upgraded to the latest commit on "develop" and the problem is still happening... |
Yes you are right, I couldn't see the whole picture from my cellphone. The We are going to refactor this to be able to define a |
Actually, the more I read it the more I think the behavior is the right one - Model 'survey' is referencing to the same model. so the relation model is in fact Are you sure the output is the proper one? it doesn't make sense to have attributes where you put them under |
The records in the |
Oups - yes you are right - sry |
#74 should be merged with this. |
Fix for issue #77. get_related_resource_type returns parent model name
This should be fixed by 64f8a6b, if it doesn't resolve your issue I'll reopen. |
The proper model is now used, but the first letter is a capital, which is probably not intended ?
|
@martinmaillard I noticed that behavior as well, I think this was introduced in commit eeab460 altough I would like @schtibe to comment on this as he might have done this on purpose |
@jsenecal Yes and no. Actually, with this commit it would've been underscored (which wouldn't be the correct behaviour as well I guess?) Commit 5b64567 then removed the default underscore behaviour without introducing the lowercase-ing again. |
@martinmaillard FYI there is a new option to format these keys: https://github.com/django-json-api/django-rest-framework-json-api/blob/develop/docs/usage.md#relationship-types |
That's great ! Thank you ! Now I'm gonna be really annoying: in my actual use case, the |
That sounds like a valid use case. I would welcome a PR so we can discuss it further |
This is a simplified version of my API:
Now if I request a survey, the type of the questions is not correct :
The issue seems to be in
utils.get_related_resource_type
. I would submit a PR, but I'm not entirely sure how to fix it without breaking something else...Also, I'm guessing that it will be necessary to be able to define a
resource_name
for related models and the relationships handling code will change, but this is still a big issue.The text was updated successfully, but these errors were encountered: