-
Notifications
You must be signed in to change notification settings - Fork 297
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
Support for custom hyperlinked related field #731
Comments
Could SerializerMethodResourceRelatedField be what you are looking for? Otherwise in the same file linked above there are many other examples. |
|
I am not 100% certain but when looking at the code it should work without passing on a model. However I am not sure why you do not want to pass on a view name. Are you trying to link to a different service than DJA is running on? |
Yep. My service has info and metadata about other services. There's also worklng around/hiding some (SQL) modelling details. |
No this is currently not possible. I had a quick look at the renderer and I do not see a quick workaround either to override the url of a relationship from the client code. A new field would need to be created and the renderer changed to be aware of it. |
I need to be able to add links to read-only resources into the
relationships
-object of a resource as easily as adding a non-link field withSerializerMethodField
. (Generating the link with SerializerMethodField is trivially easy, but they are links.) In all cases so far I can generate the link from data in the object.Is this supposed to be possible at all or is it just poorly documented?
I've tried non-model serializers,
ResourceRelatedField
,HyperlinkedRelatedField
, and I'm now at the stage where the code is running underpdb
in an attempt to figure out how things are supposed to work. It seems such a straightforward, obvious thing to do.I'm talking about things like this:
leading to
instead of
The text was updated successfully, but these errors were encountered: