diff options
author | Flavio Curella <flavio.curella@gmail.com> | 2015-07-22 09:43:21 -0500 |
---|---|---|
committer | Tim Graham <timograham@gmail.com> | 2015-07-27 18:28:13 -0400 |
commit | c2e70f02653519db3a49cd48f5158ccad7434d25 (patch) | |
tree | c0f421a6b0c26a7716c380b3e360fecc74d553fb /tests/model_inheritance | |
parent | 87d55081ea398c65b2503d22ed3907a9175ec729 (diff) | |
download | django-c2e70f02653519db3a49cd48f5158ccad7434d25.tar.gz |
Fixed #21127 -- Started deprecation toward requiring on_delete for ForeignKey/OneToOneField
Diffstat (limited to 'tests/model_inheritance')
-rw-r--r-- | tests/model_inheritance/models.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/model_inheritance/models.py b/tests/model_inheritance/models.py index a77ab15f70..22086ca11d 100644 --- a/tests/model_inheritance/models.py +++ b/tests/model_inheritance/models.py @@ -56,7 +56,7 @@ class Post(models.Model): @python_2_unicode_compatible class Attachment(models.Model): - post = models.ForeignKey(Post, related_name='attached_%(class)s_set') + post = models.ForeignKey(Post, models.CASCADE, related_name='attached_%(class)s_set') content = models.TextField() class Meta: @@ -107,7 +107,7 @@ class Rating(models.Model): class Restaurant(Place, Rating): serves_hot_dogs = models.BooleanField(default=False) serves_pizza = models.BooleanField(default=False) - chef = models.ForeignKey(Chef, null=True, blank=True) + chef = models.ForeignKey(Chef, models.SET_NULL, null=True, blank=True) class Meta(Rating.Meta): db_table = 'my_restaurant' @@ -135,8 +135,8 @@ class Supplier(Place): @python_2_unicode_compatible class ParkingLot(Place): # An explicit link to the parent (we can control the attribute name). - parent = models.OneToOneField(Place, primary_key=True, parent_link=True) - main_site = models.ForeignKey(Place, related_name='lot') + parent = models.OneToOneField(Place, models.CASCADE, primary_key=True, parent_link=True) + main_site = models.ForeignKey(Place, models.CASCADE, related_name='lot') def __str__(self): return "%s the parking lot" % self.name @@ -156,7 +156,7 @@ class Title(models.Model): class NamedURL(models.Model): - title = models.ForeignKey(Title, related_name='attached_%(app_label)s_%(class)s_set') + title = models.ForeignKey(Title, models.CASCADE, related_name='attached_%(app_label)s_%(class)s_set') url = models.URLField() class Meta: |