django 2.0 requires on_delete arg for ForeignKey/OneToOneField

the default in django 1.11 is models.CASCADE.

note: updated migrations, the models already had the required change.
This commit is contained in:
Thomas Waldmann 2018-10-19 22:03:21 +02:00
parent fb0967c0ec
commit d8bb177301
3 changed files with 19 additions and 19 deletions

View File

@ -15,7 +15,7 @@ class Migration(migrations.Migration):
migrations.CreateModel( migrations.CreateModel(
name='UserProfile', name='UserProfile',
fields=[ fields=[
('user', models.OneToOneField(related_name='profile', primary_key=True, serialize=False, to=settings.AUTH_USER_MODEL, verbose_name='user')), ('user', models.OneToOneField(related_name='profile', primary_key=True, serialize=False, to=settings.AUTH_USER_MODEL, verbose_name='user', on_delete=models.CASCADE)),
('language', models.CharField(default=b'', choices=[(b'en', b'English'), (b'de', b'German'), (b'fr', b'French'), (b'it', b'Italian'), (b'pl', b'Polish'), (b'zh-cn', b'Chinese (China)')], max_length=10, blank=True, null=True, verbose_name='language')), ('language', models.CharField(default=b'', choices=[(b'en', b'English'), (b'de', b'German'), (b'fr', b'French'), (b'it', b'Italian'), (b'pl', b'Polish'), (b'zh-cn', b'Chinese (China)')], max_length=10, blank=True, null=True, verbose_name='language')),
], ],
options={ options={

View File

@ -21,7 +21,7 @@ class Migration(migrations.Migration):
('name_re', models.CharField(help_text='Blacklisted domain. Evaluated as regex (search).', unique=True, max_length=255)), ('name_re', models.CharField(help_text='Blacklisted domain. Evaluated as regex (search).', unique=True, max_length=255)),
('last_update', models.DateTimeField(auto_now=True)), ('last_update', models.DateTimeField(auto_now=True)),
('created', models.DateTimeField(auto_now_add=True)), ('created', models.DateTimeField(auto_now_add=True)),
('created_by', models.ForeignKey(related_name=u'blacklisted_domains', to=settings.AUTH_USER_MODEL)), ('created_by', models.ForeignKey(related_name=u'blacklisted_domains', to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE)),
], ],
options={ options={
}, },
@ -40,7 +40,7 @@ class Migration(migrations.Migration):
('comment', models.CharField(default=b'', max_length=255, null=True, help_text='Some arbitrary comment about your domain. If your domain is public, the comment will be also publicly shown.', blank=True)), ('comment', models.CharField(default=b'', max_length=255, null=True, help_text='Some arbitrary comment about your domain. If your domain is public, the comment will be also publicly shown.', blank=True)),
('last_update', models.DateTimeField(auto_now=True)), ('last_update', models.DateTimeField(auto_now=True)),
('created', models.DateTimeField(auto_now_add=True)), ('created', models.DateTimeField(auto_now_add=True)),
('created_by', models.ForeignKey(related_name=u'domains', to=settings.AUTH_USER_MODEL)), ('created_by', models.ForeignKey(related_name=u'domains', to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE)),
], ],
options={ options={
}, },
@ -68,8 +68,8 @@ class Migration(migrations.Migration):
('tls_update_ipv6', models.BooleanField(default=False)), ('tls_update_ipv6', models.BooleanField(default=False)),
('last_update', models.DateTimeField(auto_now=True)), ('last_update', models.DateTimeField(auto_now=True)),
('created', models.DateTimeField(auto_now_add=True)), ('created', models.DateTimeField(auto_now_add=True)),
('created_by', models.ForeignKey(related_name=u'hosts', to=settings.AUTH_USER_MODEL)), ('created_by', models.ForeignKey(related_name=u'hosts', to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE)),
('domain', models.ForeignKey(to='main.Domain')), ('domain', models.ForeignKey(to='main.Domain', on_delete=models.CASCADE)),
], ],
options={ options={
}, },
@ -84,7 +84,7 @@ class Migration(migrations.Migration):
('interface_id_ipv4', models.CharField(default=b'', help_text='The IPv4 interface ID of this host. Use IPv4 notation.', max_length=16)), ('interface_id_ipv4', models.CharField(default=b'', help_text='The IPv4 interface ID of this host. Use IPv4 notation.', max_length=16)),
('interface_id_ipv6', models.CharField(default=b'', help_text='The IPv6 interface ID of this host. Use IPv6 notation.', max_length=22)), ('interface_id_ipv6', models.CharField(default=b'', help_text='The IPv6 interface ID of this host. Use IPv6 notation.', max_length=22)),
('available', models.BooleanField(default=True, help_text="Check if host is available/in use - if not checked, we won't accept updates for this host")), ('available', models.BooleanField(default=True, help_text="Check if host is available/in use - if not checked, we won't accept updates for this host")),
('main_host', models.ForeignKey(related_name=u'relatedhosts', to='main.Host')), ('main_host', models.ForeignKey(related_name=u'relatedhosts', to='main.Host', on_delete=models.CASCADE)),
], ],
options={ options={
}, },
@ -103,7 +103,7 @@ class Migration(migrations.Migration):
('accept_ipv6', models.BooleanField(default=False)), ('accept_ipv6', models.BooleanField(default=False)),
('last_update', models.DateTimeField(auto_now=True)), ('last_update', models.DateTimeField(auto_now=True)),
('created', models.DateTimeField(auto_now_add=True)), ('created', models.DateTimeField(auto_now_add=True)),
('created_by', models.ForeignKey(related_name=u'serviceupdater', to=settings.AUTH_USER_MODEL)), ('created_by', models.ForeignKey(related_name=u'serviceupdater', to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE)),
], ],
options={ options={
}, },
@ -121,9 +121,9 @@ class Migration(migrations.Migration):
('give_ipv6', models.BooleanField(default=False)), ('give_ipv6', models.BooleanField(default=False)),
('last_update', models.DateTimeField(auto_now=True)), ('last_update', models.DateTimeField(auto_now=True)),
('created', models.DateTimeField(auto_now_add=True)), ('created', models.DateTimeField(auto_now_add=True)),
('created_by', models.ForeignKey(related_name=u'serviceupdaterhostconfigs', to=settings.AUTH_USER_MODEL)), ('created_by', models.ForeignKey(related_name=u'serviceupdaterhostconfigs', to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE)),
('host', models.ForeignKey(related_name=u'serviceupdaterhostconfigs', to='main.Host')), ('host', models.ForeignKey(related_name=u'serviceupdaterhostconfigs', to='main.Host', on_delete=models.CASCADE)),
('service', models.ForeignKey(to='main.ServiceUpdater')), ('service', models.ForeignKey(to='main.ServiceUpdater', on_delete=models.CASCADE)),
], ],
options={ options={
}, },

View File

@ -47,7 +47,7 @@ class Migration(migrations.Migration):
migrations.AlterField( migrations.AlterField(
model_name='blacklistedhost', model_name='blacklistedhost',
name='created_by', name='created_by',
field=models.ForeignKey(related_name='blacklisted_domains', verbose_name='created by', to=settings.AUTH_USER_MODEL), field=models.ForeignKey(related_name='blacklisted_domains', verbose_name='created by', to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
@ -83,7 +83,7 @@ class Migration(migrations.Migration):
migrations.AlterField( migrations.AlterField(
model_name='domain', model_name='domain',
name='created_by', name='created_by',
field=models.ForeignKey(related_name='domains', verbose_name='created by', to=settings.AUTH_USER_MODEL), field=models.ForeignKey(related_name='domains', verbose_name='created by', to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
@ -167,13 +167,13 @@ class Migration(migrations.Migration):
migrations.AlterField( migrations.AlterField(
model_name='host', model_name='host',
name='created_by', name='created_by',
field=models.ForeignKey(related_name='hosts', verbose_name='created by', to=settings.AUTH_USER_MODEL), field=models.ForeignKey(related_name='hosts', verbose_name='created by', to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name='host', model_name='host',
name='domain', name='domain',
field=models.ForeignKey(verbose_name='domain', to='main.Domain'), field=models.ForeignKey(verbose_name='domain', to='main.Domain', on_delete=models.CASCADE),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
@ -269,7 +269,7 @@ class Migration(migrations.Migration):
migrations.AlterField( migrations.AlterField(
model_name='relatedhost', model_name='relatedhost',
name='main_host', name='main_host',
field=models.ForeignKey(related_name='relatedhosts', verbose_name='main host', to='main.Host'), field=models.ForeignKey(related_name='relatedhosts', verbose_name='main host', to='main.Host', on_delete=models.CASCADE),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
@ -305,7 +305,7 @@ class Migration(migrations.Migration):
migrations.AlterField( migrations.AlterField(
model_name='serviceupdater', model_name='serviceupdater',
name='created_by', name='created_by',
field=models.ForeignKey(related_name='serviceupdater', verbose_name='created by', to=settings.AUTH_USER_MODEL), field=models.ForeignKey(related_name='serviceupdater', verbose_name='created by', to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
@ -353,7 +353,7 @@ class Migration(migrations.Migration):
migrations.AlterField( migrations.AlterField(
model_name='serviceupdaterhostconfig', model_name='serviceupdaterhostconfig',
name='created_by', name='created_by',
field=models.ForeignKey(related_name='serviceupdaterhostconfigs', verbose_name='created by', to=settings.AUTH_USER_MODEL), field=models.ForeignKey(related_name='serviceupdaterhostconfigs', verbose_name='created by', to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
@ -371,7 +371,7 @@ class Migration(migrations.Migration):
migrations.AlterField( migrations.AlterField(
model_name='serviceupdaterhostconfig', model_name='serviceupdaterhostconfig',
name='host', name='host',
field=models.ForeignKey(related_name='serviceupdaterhostconfigs', verbose_name='host', to='main.Host'), field=models.ForeignKey(related_name='serviceupdaterhostconfigs', verbose_name='host', to='main.Host', on_delete=models.CASCADE),
preserve_default=True, preserve_default=True,
), ),
migrations.AlterField( migrations.AlterField(
@ -401,7 +401,7 @@ class Migration(migrations.Migration):
migrations.AlterField( migrations.AlterField(
model_name='serviceupdaterhostconfig', model_name='serviceupdaterhostconfig',
name='service', name='service',
field=models.ForeignKey(verbose_name='service', to='main.ServiceUpdater'), field=models.ForeignKey(verbose_name='service', to='main.ServiceUpdater', on_delete=models.CASCADE),
preserve_default=True, preserve_default=True,
), ),
] ]