#35758: Use keyword argument rather than a positional argument for on_delete in the
ForeignKey.on_delete docs.
-------------------------------------+-------------------------------------
Reporter: kay | Owner: (none)
Type: | Status: new
Cleanup/optimization |
Component: Documentation | Version: 5.1
Severity: Normal | Resolution:
Keywords: ForeignKey, code | Triage Stage: Accepted
examples |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by kay):
Replying to [comment:3 Tim Graham]:
> Since `on_delete` has now been a required argument for years, I think
there's no more value in advocating it be a keyword argument in model
definitions.
Replying to [comment:4 Claude Paroz]:
> In the same vein as we required all argument of form fields to be
keyword arguments, I'd also be in favor of having mostly keyword arguments
for model fields. In my personal practice, only the verbose_name is used
as first positional argument.
Just to clarify: I wasn't looking to start a discussion about argument
types on model fields, or to advocate one type over another. This is
solely about the docs and code snippets/examples contained within them.
Further discussions about implementation should probably go in a separate
ticket.
Replying to [comment:1 Sarah Boyce]:
> Agreed. Would you like to provide a patch?
>
> I would say this doesn't need a ticket but as you've raised one,
accepting
Yeah, I gathered that the suggested change may be small and
"insignificant" enough to not necessitate a ticket, but I didn't want to
stuff a bunch of explanations in a PR and potentially have to back and
forth there & generally thought it wise(r) to follow the proper workflow
considering I haven't contributed before. (The CONTRIBUTING file on GitHub
warns that "anything more than fixing a typo" is considered a non-trivial
PR.)
Will get working on a patch!
--
Ticket URL: <
https://code.djangoproject.com/ticket/35758#comment:5>