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/generic_relations/models.py | |
| parent | 87d55081ea398c65b2503d22ed3907a9175ec729 (diff) | |
Fixed #21127 -- Started deprecation toward requiring on_delete for ForeignKey/OneToOneField
Diffstat (limited to 'tests/generic_relations/models.py')
| -rw-r--r-- | tests/generic_relations/models.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/generic_relations/models.py b/tests/generic_relations/models.py index 1f1872dd0f..4b42354d99 100644 --- a/tests/generic_relations/models.py +++ b/tests/generic_relations/models.py @@ -23,7 +23,7 @@ from django.utils.encoding import python_2_unicode_compatible class TaggedItem(models.Model): """A tag on an item.""" tag = models.SlugField() - content_type = models.ForeignKey(ContentType) + content_type = models.ForeignKey(ContentType, models.CASCADE) object_id = models.PositiveIntegerField() content_object = GenericForeignKey() @@ -42,7 +42,7 @@ class ValuableTaggedItem(TaggedItem): class AbstractComparison(models.Model): comparative = models.CharField(max_length=50) - content_type1 = models.ForeignKey(ContentType, related_name="comparative1_set") + content_type1 = models.ForeignKey(ContentType, models.CASCADE, related_name="comparative1_set") object_id1 = models.PositiveIntegerField() first_obj = GenericForeignKey(ct_field="content_type1", fk_field="object_id1") @@ -54,7 +54,7 @@ class Comparison(AbstractComparison): A model that tests having multiple GenericForeignKeys. One is defined through an inherited abstract model and one defined directly on this class. """ - content_type2 = models.ForeignKey(ContentType, related_name="comparative2_set") + content_type2 = models.ForeignKey(ContentType, models.CASCADE, related_name="comparative2_set") object_id2 = models.PositiveIntegerField() other_obj = GenericForeignKey(ct_field="content_type2", fk_field="object_id2") @@ -120,14 +120,14 @@ class ManualPK(models.Model): class ForProxyModelModel(models.Model): - content_type = models.ForeignKey(ContentType) + content_type = models.ForeignKey(ContentType, models.CASCADE) object_id = models.PositiveIntegerField() obj = GenericForeignKey(for_concrete_model=False) title = models.CharField(max_length=255, null=True) class ForConcreteModelModel(models.Model): - content_type = models.ForeignKey(ContentType) + content_type = models.ForeignKey(ContentType, models.CASCADE) object_id = models.PositiveIntegerField() obj = GenericForeignKey() @@ -143,6 +143,6 @@ class ProxyRelatedModel(ConcreteRelatedModel): # To test fix for #7551 class AllowsNullGFK(models.Model): - content_type = models.ForeignKey(ContentType, null=True) + content_type = models.ForeignKey(ContentType, models.SET_NULL, null=True) object_id = models.PositiveIntegerField(null=True) content_object = GenericForeignKey() |
