Skip to content
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

Fix query param name for custom related pk name #9

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

salomvary
Copy link
Contributor

If the related model's primary key is not named id, use the right primary key name when constructing the query param name.

I've also sneaked in two loosely related changes, feel free to cherry-pick them:

  • Given the lack of tests or some sort of playground, I've added an example project to have a chance to test changes in isolation.
  • I've replaced get_queryset_for_field with a simple field.related_model.objects.get_queryset() call. If there is a reason for not using that, feel free to remove, but if that is the case, it would also help future contributors if there was an explanatory comment present.

If the related model's primary key is not named `id`, use the right
primary key name when constructing the query param name.
I do not see any reason for the custom related model resolution logic.
But maybe I don't understand the intent...
Do not apply the `width: 100% !important` rule to select2 components on
regular admin forms.
Do not apply the `width: 100% !important` rule to select2 components on
regular admin forms.
@salomvary
Copy link
Contributor Author

Oops, seems like I've created this pull request from the main branch of my fork, which contains all kinds of unrelated changes. Let me know if there is interest in fixing the original "custom related pk name" problem and I will clean up this pr.

@vigo
Copy link
Collaborator

vigo commented May 20, 2024

as i promised, here is the current one: https://github.com/vigo/django-admin-list-filter

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

Successfully merging this pull request may close these issues.

2 participants