summaryrefslogtreecommitdiff
path: root/tests/validation
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/validation
parent87d55081ea398c65b2503d22ed3907a9175ec729 (diff)
Fixed #21127 -- Started deprecation toward requiring on_delete for ForeignKey/OneToOneField
Diffstat (limited to 'tests/validation')
-rw-r--r--tests/validation/models.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/tests/validation/models.py b/tests/validation/models.py
index 1fe4aeb104..6b3d670000 100644
--- a/tests/validation/models.py
+++ b/tests/validation/models.py
@@ -16,9 +16,19 @@ class ModelToValidate(models.Model):
name = models.CharField(max_length=100)
created = models.DateTimeField(default=datetime.now)
number = models.IntegerField(db_column='number_val')
- parent = models.ForeignKey('self', blank=True, null=True, limit_choices_to={'number': 10})
+ parent = models.ForeignKey(
+ 'self',
+ models.SET_NULL,
+ blank=True, null=True,
+ limit_choices_to={'number': 10},
+ )
email = models.EmailField(blank=True)
- ufm = models.ForeignKey('UniqueFieldsModel', to_field='unique_charfield', blank=True, null=True)
+ ufm = models.ForeignKey(
+ 'UniqueFieldsModel',
+ models.SET_NULL,
+ to_field='unique_charfield',
+ blank=True, null=True,
+ )
url = models.URLField(blank=True)
f_with_custom_validator = models.IntegerField(blank=True, null=True, validators=[validate_answer_to_universe])
slug = models.SlugField(blank=True)
@@ -70,7 +80,7 @@ class Author(models.Model):
class Article(models.Model):
title = models.CharField(max_length=100)
- author = models.ForeignKey(Author)
+ author = models.ForeignKey(Author, models.CASCADE)
pub_date = models.DateTimeField(blank=True)
def clean(self):