#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 , 8 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → assigned |
comment:2 by , 8 years ago
| Has patch: | set |
|---|---|
| Summary: | Error in making queries example in documentation → Missing ForeignKey.on_delete argument in docs |
| Triage Stage: | Unreviewed → Ready for checkin |
Note:
See TracTickets
for help on using tickets.
PR