-
Notifications
You must be signed in to change notification settings - Fork 157
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
Managing the combination of NestedSimpleRouter.lookup and GenericViewset.lookup_field #147
Comments
This is an issue that I've faced too -- and I found a sneaky solution for it. In
Before: After: |
Any chance this would be integrated in the lib somehow ? Extra param to disable prefix or simply a rule that disable prefix when lookup param is empty ? |
I cannot say that I truly understand the implications of this change. Yet is very possible to be accepted, given that new automated tests do pass along the existing ones in a PR 👍 . |
Having a bit of trouble with this but it could just be me: is it possible to just use only one of these fields to declare a lookup string? Currently we have a non-primary-key field that's used for lookup, but we end up with some weirdness.
Leaving the default
lookup_field
on ourGenericViewset
subclass causes any of our "lookup" text to have_pk
appended to it, such asfoobar_pk
If we update the
lookup_field
we can getfoobar_foobar
, but trying to setlookup=''
for the router leaves us with_foobar
I see this behavior comes from the very beginning of
NestedMixin.__init__
... Basically I just want the lookup field to only befoobar
with nothing else, is there a way to do that or am I missing something?The text was updated successfully, but these errors were encountered: