Opened 2 months ago

Closed 2 months ago

Last modified 2 months ago

#28653 closed Bug (fixed)

Missing ForeignKey.on_delete argument in docs

Reported by: Stefan Schneider Owned by: Stefan Schneider
Component: Documentation Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

There's a second required argument needed for Foreign Key fields: on_delete
. Since 1.11 not providing the argument gives an Deprecation Warning but since 2.0 it's required and gives an error if not provieded

In the documentation for Making Queries the example doesn't provide the on_delete argument.

class Entry(models.Model):
    blog = models.ForeignKey(Blog)

should be:

class Entry(models.Model):
    blog = models.ForeignKey(Blog, on_delete='CASCADING')

Change History (5)

comment:1 Changed 2 months ago by Stefan Schneider

Owner: changed from nobody to Stefan Schneider
Status: newassigned

comment:2 Changed 2 months ago by Tim Graham

Has patch: set
Summary: Error in making queries example in documentationMissing ForeignKey.on_delete argument in docs
Triage Stage: UnreviewedReady for checkin

comment:3 Changed 2 months ago by Tim Graham <timograham@…>

Resolution: fixed
Status: assignedclosed

In 08c8c3ea:

Fixed #28653 -- Added missing ForeignKey.on_delete argument in docs.

comment:4 Changed 2 months ago by Tim Graham <timograham@…>

In eff5f83:

[2.0.x] Fixed #28653 -- Added missing ForeignKey.on_delete argument in docs.

Backport of 08c8c3ead97893ec0e1dece699525ad7ed27c2d7 from master

comment:5 Changed 2 months ago by Tim Graham <timograham@…>

In 251190cc:

[1.11.x] Fixed #28653 -- Added missing ForeignKey.on_delete argument in docs.

Backport of 08c8c3ead97893ec0e1dece699525ad7ed27c2d7 from master

Note: See TracTickets for help on using tickets.
Back to Top