Permalink
Browse files

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

…in docs.

Backport of 08c8c3e from master
  • Loading branch information...
xorg authored and timgraham committed Sep 29, 2017
1 parent e8a82e8 commit 251190cc5956c835a1d7dd3bd084370f0ec50cb5
@@ -1074,7 +1074,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:
@@ -84,7 +84,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)
...
@@ -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):
@@ -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()

0 comments on commit 251190c

Please sign in to comment.