summaryrefslogtreecommitdiff
path: root/tests/indexes
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/indexes
parent87d55081ea398c65b2503d22ed3907a9175ec729 (diff)
downloaddjango-c2e70f02653519db3a49cd48f5158ccad7434d25.tar.gz
Fixed #21127 -- Started deprecation toward requiring on_delete for ForeignKey/OneToOneField
Diffstat (limited to 'tests/indexes')
-rw-r--r--tests/indexes/models.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/indexes/models.py b/tests/indexes/models.py
index 3e9cbf630b..b348f0365c 100644
--- a/tests/indexes/models.py
+++ b/tests/indexes/models.py
@@ -8,17 +8,17 @@ class CurrentTranslation(models.ForeignObject):
# Avoid validation
requires_unique_target = False
- def __init__(self, to, from_fields, to_fields, **kwargs):
+ def __init__(self, to, on_delete, from_fields, to_fields, **kwargs):
# Disable reverse relation
kwargs['related_name'] = '+'
# Set unique to enable model cache.
kwargs['unique'] = True
- super(CurrentTranslation, self).__init__(to, from_fields, to_fields, **kwargs)
+ super(CurrentTranslation, self).__init__(to, on_delete, from_fields, to_fields, **kwargs)
class ArticleTranslation(models.Model):
- article = models.ForeignKey('indexes.Article')
+ article = models.ForeignKey('indexes.Article', models.CASCADE)
language = models.CharField(max_length=10, unique=True)
content = models.TextField()
@@ -28,7 +28,7 @@ class Article(models.Model):
pub_date = models.DateTimeField()
# Add virtual relation to the ArticleTranslation model.
- translation = CurrentTranslation(ArticleTranslation, ['id'], ['article'])
+ translation = CurrentTranslation(ArticleTranslation, models.CASCADE, ['id'], ['article'])
class Meta:
index_together = [