mirror of
https://github.com/Hopiu/django-watson.git
synced 2026-03-16 22:00:22 +00:00
Set on_delete=CASCADE for ForeignKey model fields
This is the default behavior, but since on_delete argument will be required in Django 2.0, and a warning is thrown in recent versions of Django when the attribute is missing, it's better to set it in code. In addition, "explicit is better than implicit"
This commit is contained in:
parent
fa2ebaec13
commit
f5e173e1a2
2 changed files with 2 additions and 1 deletions
|
|
@ -32,7 +32,7 @@ class Migration(migrations.Migration):
|
|||
('content', models.TextField(blank=True)),
|
||||
('url', models.CharField(max_length=1000, blank=True)),
|
||||
('meta_encoded', models.TextField()),
|
||||
('content_type', models.ForeignKey(to='contenttypes.ContentType')),
|
||||
('content_type', models.ForeignKey(to='contenttypes.ContentType', on_delete=models.CASCADE)),
|
||||
],
|
||||
options={
|
||||
'verbose_name_plural': 'search entries',
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ class SearchEntry(models.Model):
|
|||
|
||||
content_type = models.ForeignKey(
|
||||
ContentType,
|
||||
on_delete = models.CASCADE,
|
||||
)
|
||||
|
||||
object_id = models.TextField()
|
||||
|
|
|
|||
Loading…
Reference in a new issue