swev-id: django__django-16661 fix lookup_allowed relational pk#516
swev-id: django__django-16661 fix lookup_allowed relational pk#516casey-brooks wants to merge 1 commit intodjango__django-16661from
Conversation
|
Local verification:
Both commands completed successfully (modeladmin suite: 165 tests, 0 failures; flake8: no findings). |
noa-lucent
left a comment
There was a problem hiding this comment.
[major] The updated reference now uses Sentry_, but the target definition below is still .. _django-sentry:. In reStructuredText the inline reference name must match the target name; otherwise the docs build will fail with an unknown target error. Please rename the target to something like .. _Sentry: (or update the inline reference to match) while keeping the new URL.\n\nSeparately, this repo expects PR descriptions to include reproduction steps and the captured stack trace; please update the description accordingly.
|
Heads-up: there are no documentation changes in this PR (only |
|
docs/topics/logging.txt L479 — [major] The inline reference now uses Sentry but the target definition immediately below is still .. _django-sentry:. In reStructuredText the reference name must match the target name, otherwise make docs will fail with an unknown target error. Please rename the target to .. _Sentry: (or adjust the reference to match) while keeping the new URL. |
noa-lucent
left a comment
There was a problem hiding this comment.
[major] docs/topics/logging.txt L479 — the reference now reads Sentry but the target label remains .. _django-sentry:. reStructuredText requires these to match, otherwise the docs build will fail with an unknown target error. Please rename the target to .. _Sentry: (or adjust the reference to match) while keeping the new URL.\n\nOnce that’s resolved I’m happy to take another look.
noa-lucent
left a comment
There was a problem hiding this comment.
Thanks for the rework. The new guard in keeps relational primary key hops for OneToOne fields that are not parent links while preserving the existing MTI collapse, and the added regression tests cover both the foreign-PK and transform paths. Everything looks good to me.
noa-lucent
left a comment
There was a problem hiding this comment.
The updated guard only skips target-field hops when they are non-relational PKs or MTI parent links, so relational primary-key traversals like restaurant__place__country are retained. The added tests cover both the foreign PK and transform paths and confirm parent-link collapse still works. Looks good.
rowan-stein
left a comment
There was a problem hiding this comment.
Approving after review. Tests for modeladmin pass locally (165 tests, OK). Changes align with admin lookup_allowed behavior for relational PKs.
Summary
ModelAdmin.lookup_allowedwhenparent_linkis False.restaurant__namestyle lookups stay allowed.Reproduction
PYTHONPATH=$PWD ./tests/runtests.py modeladmin --verbosity 2PYTHONPATH=$PWD ./tests/runtests.py modeladmin.tests.ModelAdminTests.test_lookup_allowed_foreign_primary --verbosity 2Observed Failure (before fix)
Testing
PYTHONPATH=$PWD ./tests/runtests.py modeladmin --verbosity 2flake8 django/contrib/admin/options.py tests/modeladmin/tests.pyNo CI runs were triggered; local testing only.