chibisov / drf-extensions

DRF-extensions is a collection of custom extensions for Django REST Framework
http://chibisov.github.io/drf-extensions/docs
MIT License
1.46k stars 208 forks source link

Hyperlink fields that support nested serialization #17

Open thedrow opened 10 years ago

thedrow commented 10 years ago

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.

chibisov commented 10 years ago

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.

DSpeckhals commented 10 years ago

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.

thedrow commented 9 years ago

https://github.com/tomchristie/django-rest-framework/issues/1978 will certainly help or resolve this issue entirely.

damonkelley commented 9 years ago

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.

chibisov commented 9 years ago

@damonkelley, I will be glad to review your pull request.

sazary commented 9 years ago

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!

gnarea commented 9 years ago

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.

rrauenza commented 9 years ago

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.

jsenecal commented 9 years ago

Same here... It would be great to have such documentation.

howardjones commented 9 years ago

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)

auvipy commented 8 years ago

I'm considering this feature to be included.

auvipy commented 8 years ago

this should be addressed after releasing 0.3.0 version

AncAinu commented 8 years ago

So now that we are on version 3.3.0, and this ticket still open, do you plan to include this feature @auvipy ?

auvipy commented 8 years ago

contributions are welcome

auvipy commented 8 years ago

I'm busy with cleaning up the drf-extension codes from legacy codes.

mbaragiola commented 7 years ago

Any news about this?

0x000bff commented 5 years ago

It's been a few years, is this still an active project?

auvipy commented 5 years ago

yes, it is. check the commit history