Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#28653 closed Bug (fixed)

Missing ForeignKey.on_delete argument in docs

Reported by: Stefan Schneider Owned by: Stefan Schneider
Component: Documentation Version: dev
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 by Stefan Schneider, 7 years ago

Owner: changed from nobody to Stefan Schneider
Status: newassigned

comment:2 by Tim Graham, 7 years ago

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

comment:3 by Tim Graham <timograham@…>, 7 years ago

Resolution: fixed
Status: assignedclosed

In 08c8c3ea:

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

comment:4 by Tim Graham <timograham@…>, 7 years ago

In eff5f83:

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

Backport of 08c8c3ead97893ec0e1dece699525ad7ed27c2d7 from master

comment:5 by Tim Graham <timograham@…>, 7 years ago

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