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

This commit is contained in:
Stefan Schneider 2017-09-29 17:38:28 +02:00 committed by Tim Graham
parent 3fa0a824c2
commit 08c8c3ead9
4 changed files with 4 additions and 4 deletions

View File

@ -1064,7 +1064,7 @@ fields. Suppose we have an additional model to the example above::
class Restaurant(models.Model): class Restaurant(models.Model):
pizzas = models.ManyToManyField(Pizza, related_name='restaurants') 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: The following are all legal:

View File

@ -80,7 +80,7 @@ Suppose you have this pair of models, representing a simple blog system::
... ...
class Entry(models.Model): class Entry(models.Model):
blog = models.ForeignKey(Blog) blog = models.ForeignKey(Blog, on_delete=models.CASCADE)
published = models.DateTimeField(default=datetime.datetime.now) published = models.DateTimeField(default=datetime.datetime.now)
... ...

View File

@ -34,7 +34,7 @@ used to track the inventory for a series of online bookstores:
price = models.DecimalField(max_digits=10, decimal_places=2) price = models.DecimalField(max_digits=10, decimal_places=2)
rating = models.FloatField() rating = models.FloatField()
authors = models.ManyToManyField(Author) authors = models.ManyToManyField(Author)
publisher = models.ForeignKey(Publisher) publisher = models.ForeignKey(Publisher, on_delete=models.CASCADE)
pubdate = models.DateField() pubdate = models.DateField()
class Store(models.Model): class Store(models.Model):

View File

@ -34,7 +34,7 @@ models, which comprise a Weblog application:
return self.name return self.name
class Entry(models.Model): class Entry(models.Model):
blog = models.ForeignKey(Blog) blog = models.ForeignKey(Blog, on_delete=models.CASCADE)
headline = models.CharField(max_length=255) headline = models.CharField(max_length=255)
body_text = models.TextField() body_text = models.TextField()
pub_date = models.DateField() pub_date = models.DateField()