#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 Tim Graham):
`on_delete` was an optional argument until Django 2.0 (#21127,
ddd3268975dca9094d94ab1df56dae0a24a58865). At that time, the tests were
updated to remove `on_delete=` (for brevity) and `on_delete=` was added to
the documentation examples as a keyword argument (for backward
compatibility with older Django versions).
I think some of the confusion comes from documentation that wasn't
completely updated at that time.
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.
--
Ticket URL: <https://code.djangoproject.com/ticket/35758#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/01070191ebfd9b7f-3552afde-6519-4852-a289-aa7cf20239b6-000000%40eu-central-1.amazonses.com.