Always set explicit ForeignKey.on_delete values.

Review Request #10267 — Created Oct. 23, 2018 and submitted

Information

Django Evolution
master
16c6310...

Reviewers

Django 2.0 requires ForeignKey instances to have on_delete set.
Prior to 2.0, these defaulted to CASCADE, which would delete the
owning model if the object on the other end of the relation was deleted
within Django's ORM. In 2.0, they apparently wanted this to be explicit,
and 1.11 pretty heavily announces deprecation warnings in preparation
for that.

This change adds explicit on_delete settings for each ForeignKey in
the codebase, and updates the creation of ForeignKeys from a database
signature to provide a suitable default if not found in the signature.

Unit tests pass on Django 1.6 through 1.11, and on 2.1 with other
pending changes.

brennie
  1. Ship It!
  2. 
      
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to master (6c08cbc)