summaryrefslogtreecommitdiff
path: root/tests/model_fields/models.py
diff options
context:
space:
mode:
authorFlavio Curella <flavio.curella@gmail.com>2015-07-22 09:43:21 -0500
committerTim Graham <timograham@gmail.com>2015-07-27 18:28:13 -0400
commitc2e70f02653519db3a49cd48f5158ccad7434d25 (patch)
treec0f421a6b0c26a7716c380b3e360fecc74d553fb /tests/model_fields/models.py
parent87d55081ea398c65b2503d22ed3907a9175ec729 (diff)
Fixed #21127 -- Started deprecation toward requiring on_delete for ForeignKey/OneToOneField
Diffstat (limited to 'tests/model_fields/models.py')
-rw-r--r--tests/model_fields/models.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/tests/model_fields/models.py b/tests/model_fields/models.py
index a836cbb97e..0f2e54f939 100644
--- a/tests/model_fields/models.py
+++ b/tests/model_fields/models.py
@@ -31,7 +31,7 @@ def get_foo():
class Bar(models.Model):
b = models.CharField(max_length=10)
- a = models.ForeignKey(Foo, default=get_foo, related_name=b'bars')
+ a = models.ForeignKey(Foo, models.CASCADE, default=get_foo, related_name=b'bars')
class Whiz(models.Model):
@@ -145,13 +145,13 @@ class PrimaryKeyCharModel(models.Model):
class FksToBooleans(models.Model):
"""Model with FKs to models with {Null,}BooleanField's, #15040"""
- bf = models.ForeignKey(BooleanModel)
- nbf = models.ForeignKey(NullBooleanModel)
+ bf = models.ForeignKey(BooleanModel, models.CASCADE)
+ nbf = models.ForeignKey(NullBooleanModel, models.CASCADE)
class FkToChar(models.Model):
"""Model with FK to a model with a CharField primary key, #19299"""
- out = models.ForeignKey(PrimaryKeyCharModel)
+ out = models.ForeignKey(PrimaryKeyCharModel, models.CASCADE)
class RenamedField(models.Model):
@@ -343,19 +343,21 @@ class AllFieldsModel(models.Model):
fo = ForeignObject(
'self',
+ on_delete=models.CASCADE,
from_fields=['abstract_non_concrete_id'],
to_fields=['id'],
related_name='reverse'
)
fk = ForeignKey(
'self',
+ models.CASCADE,
related_name='reverse2'
)
m2m = ManyToManyField('self')
- oto = OneToOneField('self')
+ oto = OneToOneField('self', models.CASCADE)
object_id = models.PositiveIntegerField()
- content_type = models.ForeignKey(ContentType)
+ content_type = models.ForeignKey(ContentType, models.CASCADE)
gfk = GenericForeignKey()
gr = GenericRelation(DataModel)
@@ -376,7 +378,7 @@ class PrimaryKeyUUIDModel(models.Model):
class RelatedToUUIDModel(models.Model):
- uuid_fk = models.ForeignKey('PrimaryKeyUUIDModel')
+ uuid_fk = models.ForeignKey('PrimaryKeyUUIDModel', models.CASCADE)
class UUIDChild(PrimaryKeyUUIDModel):