drf-extensions
drf-extensions copied to clipboard
Hyperlink fields that support nested serialization
drf-nested-routers provides (incomplete) nested versions of hyperlinked fields (https://github.com/alanjds/drf-nested-routers/blob/master/rest_framework_nested/relations.py). It be awesome to have those in drf-extensions.
Yep, we need it. I don't have time for this feature right now, but it's next in the order. It would be great if you started and sent pull requests or suggested some thoughts how it should be implemented.
I think this is a good idea as well. I spent an hour or so trying to get it to work, before looking at the code and seeing that it's not possible yet. For now, I'm using nested and un-nested urls, but hyperlinking to the un-nested one. It will be nice when this feature can be implemented.
https://github.com/tomchristie/django-rest-framework/issues/1978 will certainly help or resolve this issue entirely.
It appears that Tom has rejected the proposal from the issue above.
I have a rough, but working, implementation to add this functionality. I would be happy to open a pull request and get some feedback.
@damonkelley, I will be glad to review your pull request.
guys, you seriously need to note this in your documentations with bold font! I've wasted some really precious hours trying to do this and now I'm seeing this. the error message doesn't help at all too: Could not resolve URL for hyperlinked relationship using view name "productfield-detail". You may have failed to include the related model in your API, or incorrectly configured the "lookup_field" attribute on this field.
Please, note this in docs!
Just found myself in the same situation as @sazary, so I second his suggestion of giving people the heads-up.
By the way, isn't #67 the root cause for this? It's hard to tell since the description is in Russian.
Would be great if this could be fixed. I just spent an hour or two trying to figure out why I was getting the same error.
Same here... It would be great to have such documentation.
Ah, I have been getting the same error as @sazary and assumed it was to do with view namespaces or lookup_field (I am using lookup_field, which made it even more confusing!).
If I remove the HyperlinkedRelationshipFields from my Serializer, can ExtendedDefaultRouter work with lookup_field anyway? I am aiming to get URLs like: /api/locations/{location}/items/{itemname}
(both models have a pk that isn't the name, but the item names are unique within each location, and the names are meaningful to users)
I'm considering this feature to be included.
this should be addressed after releasing 0.3.0 version
So now that we are on version 3.3.0, and this ticket still open, do you plan to include this feature @auvipy ?
contributions are welcome
I'm busy with cleaning up the drf-extension codes from legacy codes.
Any news about this?
It's been a few years, is this still an active project?
yes, it is. check the commit history