Open gretkierewicz opened 3 years ago
For that particular use case, it doesn't seem like you'd use nested routers because a OneToOne isn't nested.
Not sure how would you pass OneToOne resource's parent lookup. I'm building OneToOne relation in nested resource so it is even more complicated there.
Here is the pull request. Update for allowing to pass lookup_field=None #211
It should be fully back-compatible.
Hi!
I would like to suggest some minor update for
NestedHyperlinkedIdentityField
in terms ofOneToOne
relations.As there is no need of providing
lookup_field
in such scenario, allowinglookup_field=None
field's kwarg could provide url just fine.Example url patterns: /basic_resource/ /basic_resource/{basic_resource_lookup}/ /basic_resource/{basic_resource_lookup}/nested_OneToOne_resource/
As
parent_lookup_kwargs
pointing basic_resource_lookup would be declared in nestedserializer
- it is just enough to get exact instance of nested resource for each basic_recource