Skip to content

Generics can't filter on a different lookup kwarg #1188

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

Closed
kevin-brown opened this issue Oct 20, 2013 · 1 comment
Closed

Generics can't filter on a different lookup kwarg #1188

kevin-brown opened this issue Oct 20, 2013 · 1 comment

Comments

@kevin-brown
Copy link
Member

lookup_kwarg was added at in dc45bc7, that allowed you to get an object based on a different kwarg than the lookup_field. This was useful for cases where having the kwarg match the lookup_field does not make sense (too generic) or where it needs to be consistent across your appplication.

In the merge for that branch (835d3f8), lookup_kwargs was dropped. I can't find the commit that it was dropped in, or any reason for why it was done.

This is probably related to django/#20342, but that was eventually closed.

@tomchristie
Copy link
Member

Added lookup_url_kwarg to allow the URL kwarg and the model lookup field to differ.

lookup_kwargs was dropped

I don't think lookup_kwarg was ever a bit of public API - I think the name probably just changed to lookup_field somewhere before it was released.

Latest commit now adds lookup_url_kwarg, matching the django-vanilla-views lookup style.

https://github.com/tomchristie/django-vanilla-views/blob/master/vanilla/model_views.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants