Skip to content

Remove explicit lookup_field from all ViewSet#308

Merged
brianhelba merged 1 commit intomasterfrom
remove-redundant-lookup-field
Mar 3, 2026
Merged

Remove explicit lookup_field from all ViewSet#308
brianhelba merged 1 commit intomasterfrom
remove-redundant-lookup-field

Conversation

@brianhelba
Copy link
Collaborator

DRF ViewSet defaults to using lookup_field = "pk", which is Django's general pointer to any Model's primary key field.

Overriding lookup_field = "id" is unnecessary, makes the usage of DRF more surprising and less idiomatic, and introduces Ruff A002 (builtin-argument-shadowing) violations (where the id parameter shadows a Python builtin).

DRF `ViewSet` defaults to using `lookup_field = "pk"`, which is Django's
general pointer to any `Model`'s primary key field.

Overriding `lookup_field = "id"` is unnecessary, makes the usage of DRF
more surprising and less idiomatic, and introduces Ruff A002
(`builtin-argument-shadowing`) violations (where the `id` parameter shadows
a Python builtin).
@brianhelba brianhelba requested a review from annehaley February 28, 2026 18:55
@cloudflare-workers-and-pages
Copy link

Deploying geodatalytics with  Cloudflare Pages  Cloudflare Pages

Latest commit: 3abeaf4
Status: ✅  Deploy successful!
Preview URL: https://8e5a4687.geodatalytics.pages.dev
Branch Preview URL: https://remove-redundant-lookup-fiel.geodatalytics.pages.dev

View logs

@brianhelba brianhelba merged commit 8dc9518 into master Mar 3, 2026
4 checks passed
@brianhelba brianhelba deleted the remove-redundant-lookup-field branch March 3, 2026 00:01
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