diff --git a/docs/ref/models/querysets.txt b/docs/ref/models/querysets.txt index ea2a3ef060..214e18b376 100644 --- a/docs/ref/models/querysets.txt +++ b/docs/ref/models/querysets.txt @@ -1064,7 +1064,7 @@ fields. Suppose we have an additional model to the example above:: class Restaurant(models.Model): pizzas = models.ManyToManyField(Pizza, related_name='restaurants') - best_pizza = models.ForeignKey(Pizza, related_name='championed_by') + best_pizza = models.ForeignKey(Pizza, related_name='championed_by', on_delete=models.CASCADE) The following are all legal: diff --git a/docs/topics/conditional-view-processing.txt b/docs/topics/conditional-view-processing.txt index 9016cd3b02..617f3febbf 100644 --- a/docs/topics/conditional-view-processing.txt +++ b/docs/topics/conditional-view-processing.txt @@ -80,7 +80,7 @@ Suppose you have this pair of models, representing a simple blog system:: ... class Entry(models.Model): - blog = models.ForeignKey(Blog) + blog = models.ForeignKey(Blog, on_delete=models.CASCADE) published = models.DateTimeField(default=datetime.datetime.now) ... diff --git a/docs/topics/db/aggregation.txt b/docs/topics/db/aggregation.txt index 523f6e0aaa..7c5eb5791a 100644 --- a/docs/topics/db/aggregation.txt +++ b/docs/topics/db/aggregation.txt @@ -34,7 +34,7 @@ used to track the inventory for a series of online bookstores: price = models.DecimalField(max_digits=10, decimal_places=2) rating = models.FloatField() authors = models.ManyToManyField(Author) - publisher = models.ForeignKey(Publisher) + publisher = models.ForeignKey(Publisher, on_delete=models.CASCADE) pubdate = models.DateField() class Store(models.Model): diff --git a/docs/topics/db/queries.txt b/docs/topics/db/queries.txt index 7bc090f5e7..efbc7c569b 100644 --- a/docs/topics/db/queries.txt +++ b/docs/topics/db/queries.txt @@ -34,7 +34,7 @@ models, which comprise a Weblog application: return self.name class Entry(models.Model): - blog = models.ForeignKey(Blog) + blog = models.ForeignKey(Blog, on_delete=models.CASCADE) headline = models.CharField(max_length=255) body_text = models.TextField() pub_date = models.DateField()