From be6284c0a0acf54960a9c184854bcfe31b18bebc Mon Sep 17 00:00:00 2001 From: Karl Hobley Date: Thu, 26 Oct 2017 16:02:36 +0100 Subject: [PATCH] Add on_delete= on search models --- wagtail/tests/search/migrations/0001_initial.py | 2 +- wagtail/tests/search/models.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/wagtail/tests/search/migrations/0001_initial.py b/wagtail/tests/search/migrations/0001_initial.py index 71d3928370..018bcfdb9c 100644 --- a/wagtail/tests/search/migrations/0001_initial.py +++ b/wagtail/tests/search/migrations/0001_initial.py @@ -48,7 +48,7 @@ class Migration(migrations.Migration): fields=[ ('book_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='searchtests.Book')), ('setting', models.CharField(max_length=255)), - ('protagonist', models.OneToOneField(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='searchtests.Character')), + ('protagonist', models.OneToOneField(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='searchtests.Character')), ], bases=('searchtests.book',), ), diff --git a/wagtail/tests/search/models.py b/wagtail/tests/search/models.py index eba71e8eb7..5d9baf68fb 100644 --- a/wagtail/tests/search/models.py +++ b/wagtail/tests/search/models.py @@ -71,7 +71,7 @@ class Book(index.Indexed, models.Model): class Character(models.Model): name = models.CharField(max_length=255) - novel = models.ForeignKey('Novel', related_name='characters') + novel = models.ForeignKey('Novel', related_name='characters', on_delete=models.CASCADE) search_fields = [ index.SearchField('name'), @@ -83,7 +83,7 @@ class Character(models.Model): class Novel(Book): setting = models.CharField(max_length=255) - protagonist = models.OneToOneField(Character, related_name='+', null=True) + protagonist = models.OneToOneField(Character, related_name='+', null=True, on_delete=models.SET_NULL) search_fields = Book.search_fields + [ index.SearchField('setting', partial_match=True),