Specify on_delete parameter for all ForeignKeys
authorVik Fearing <vikreykaj@gmail.com>
Fri, 7 Sep 2018 23:29:10 +0000 (16:29 -0700)
committerMagnus Hagander <magnus@hagander.net>
Fri, 7 Sep 2018 23:29:10 +0000 (16:29 -0700)
This will be required in future Django versions, and currently throws
deprecation warnings.

38 files changed:
postgresqleu/accounting/migrations/0001_initial.py
postgresqleu/accounting/models.py
postgresqleu/adyen/migrations/0001_initial.py
postgresqleu/adyen/models.py
postgresqleu/confreg/migrations/0001_initial.py
postgresqleu/confreg/migrations/0002_auto_20160108_1924.py
postgresqleu/confreg/migrations/0005_vat.py
postgresqleu/confreg/migrations/0008_volunteers.py
postgresqleu/confreg/migrations/0009_confslides.py
postgresqleu/confreg/migrations/0011_optout.py
postgresqleu/confreg/migrations/0013_series_required.py
postgresqleu/confreg/migrations/0016_separate_registrator.py
postgresqleu/confreg/migrations/0019_purge_personal_data.py
postgresqleu/confreg/migrations/0023_accesstokens.py
postgresqleu/confreg/models.py
postgresqleu/confsponsor/migrations/0001_initial.py
postgresqleu/confsponsor/migrations/0007_contract_per_conference.py
postgresqleu/confsponsor/models.py
postgresqleu/confwiki/migrations/0001_initial.py
postgresqleu/confwiki/models.py
postgresqleu/countries/migrations/0002_europecountry.py
postgresqleu/countries/models.py
postgresqleu/elections/migrations/0001_initial.py
postgresqleu/elections/migrations/0002_auto_20160108_1924.py
postgresqleu/elections/models.py
postgresqleu/invoices/migrations/0001_initial.py
postgresqleu/invoices/migrations/0002_invoice_paidusing.py
postgresqleu/invoices/migrations/0004_refund_tracking.py
postgresqleu/invoices/migrations/0005_vat.py
postgresqleu/invoices/migrations/0006_refund_vat.py
postgresqleu/invoices/models.py
postgresqleu/membership/migrations/0001_initial.py
postgresqleu/membership/models.py
postgresqleu/newsevents/migrations/0001_initial.py
postgresqleu/paypal/migrations/0001_initial.py
postgresqleu/paypal/models.py
postgresqleu/trustlypayment/migrations/0001_initial.py
postgresqleu/trustlypayment/models.py

index c487566c5682cd70467a627d7f218022d1e8d971..9af959307f5eeb48a0c1682d4ee42f8eb56c01a1 100644 (file)
@@ -43,7 +43,7 @@ class Migration(migrations.Migration):
                 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                 ('name', models.CharField(max_length=100)),
                 ('foldable', models.BooleanField(default=False)),
-                ('accountclass', models.ForeignKey(default=False, to='accounting.AccountClass')),
+                ('accountclass', models.ForeignKey(default=False, to='accounting.AccountClass', on_delete=models.CASCADE)),
             ],
             options={
                 'ordering': ('name',),
@@ -54,7 +54,7 @@ class Migration(migrations.Migration):
             fields=[
                 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                 ('amount', models.DecimalField(max_digits=10, decimal_places=2, validators=[postgresqleu.accounting.models.nonzero_validator])),
-                ('account', models.ForeignKey(to='accounting.Account', to_field=b'num')),
+                ('account', models.ForeignKey(to='accounting.Account', to_field=b'num', on_delete=models.CASCADE)),
             ],
             options={
                 'ordering': ('year__pk', 'account'),
@@ -75,8 +75,8 @@ class Migration(migrations.Migration):
                 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                 ('amount', models.DecimalField(max_digits=10, decimal_places=2, validators=[postgresqleu.accounting.models.nonzero_validator])),
                 ('description', models.CharField(max_length=200)),
-                ('account', models.ForeignKey(to='accounting.Account', to_field=b'num')),
-                ('journal', models.ForeignKey(to='accounting.JournalEntry')),
+                ('account', models.ForeignKey(to='accounting.Account', to_field=b'num', on_delete=models.CASCADE)),
+                ('journal', models.ForeignKey(to='accounting.JournalEntry', on_delete=models.CASCADE)),
             ],
         ),
         migrations.CreateModel(
@@ -84,7 +84,7 @@ class Migration(migrations.Migration):
             fields=[
                 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                 ('url', models.URLField()),
-                ('journal', models.ForeignKey(to='accounting.JournalEntry')),
+                ('journal', models.ForeignKey(to='accounting.JournalEntry', on_delete=models.CASCADE)),
             ],
         ),
         migrations.CreateModel(
@@ -111,22 +111,22 @@ class Migration(migrations.Migration):
         migrations.AddField(
             model_name='journalitem',
             name='object',
-            field=models.ForeignKey(blank=True, to='accounting.Object', null=True),
+            field=models.ForeignKey(blank=True, to='accounting.Object', null=True, on_delete=models.CASCADE),
         ),
         migrations.AddField(
             model_name='journalentry',
             name='year',
-            field=models.ForeignKey(to='accounting.Year'),
+            field=models.ForeignKey(to='accounting.Year', on_delete=models.CASCADE),
         ),
         migrations.AddField(
             model_name='incomingbalance',
             name='year',
-            field=models.ForeignKey(to='accounting.Year'),
+            field=models.ForeignKey(to='accounting.Year', on_delete=models.CASCADE),
         ),
         migrations.AddField(
             model_name='account',
             name='group',
-            field=models.ForeignKey(to='accounting.AccountGroup'),
+            field=models.ForeignKey(to='accounting.AccountGroup', on_delete=models.CASCADE),
         ),
         migrations.AlterUniqueTogether(
             name='journalentry',
index 120aa11e2430a5adfd1e0eca191dae6fb6befd14..371cbf767a317cbcdf81173aaad4d63f1047129f 100644 (file)
@@ -25,7 +25,7 @@ class AccountClass(models.Model):
 
 class AccountGroup(models.Model):
        name = models.CharField(max_length=100)
-       accountclass = models.ForeignKey(AccountClass, blank=False, default=False)
+       accountclass = models.ForeignKey(AccountClass, blank=False, default=False, on_delete=models.CASCADE)
        foldable = models.BooleanField(null=False, blank=False, default=False)
 
        def __unicode__(self):
@@ -36,7 +36,7 @@ class AccountGroup(models.Model):
 
 class Account(models.Model):
        num = models.IntegerField(verbose_name="Account number", unique=True)
-       group = models.ForeignKey(AccountGroup, null=False, blank=False)
+       group = models.ForeignKey(AccountGroup, null=False, blank=False, on_delete=models.CASCADE)
        name = models.CharField(max_length=100)
        availableforinvoicing = models.BooleanField(null=False, blank=False, default=False)
        objectrequirement = models.IntegerField(null=False, default=0, choices=ACCOUNT_OBJECT_CHOICES, verbose_name="Object requirements")
@@ -60,8 +60,8 @@ class Year(models.Model):
                ordering = ('-year',)
 
 class IncomingBalance(models.Model):
-       year = models.ForeignKey(Year, null=False, blank=False)
-       account = models.ForeignKey(Account, to_field='num', null=False, blank=False)
+       year = models.ForeignKey(Year, null=False, blank=False, on_delete=models.CASCADE)
+       account = models.ForeignKey(Account, to_field='num', null=False, blank=False, on_delete=models.CASCADE)
        amount = models.DecimalField(max_digits=10, decimal_places=2, null=False, blank=False, validators=[nonzero_validator,])
 
        def __unicode__(self):
@@ -83,7 +83,7 @@ class Object(models.Model):
                ordering = ('name', )
 
 class JournalEntry(models.Model):
-       year = models.ForeignKey(Year, null=False, blank=False)
+       year = models.ForeignKey(Year, null=False, blank=False, on_delete=models.CASCADE)
        seq = models.IntegerField(null=False, blank=False)
        date = models.DateField(null=False, blank=False)
        closed = models.BooleanField(blank=False, null=False, default=False)
@@ -96,10 +96,10 @@ class JournalEntry(models.Model):
 
 
 class JournalItem(models.Model):
-       journal = models.ForeignKey(JournalEntry, null=False, blank=False)
-       account = models.ForeignKey(Account, to_field='num', null=False, blank=False)
+       journal = models.ForeignKey(JournalEntry, null=False, blank=False, on_delete=models.CASCADE)
+       account = models.ForeignKey(Account, to_field='num', null=False, blank=False, on_delete=models.CASCADE)
        amount = models.DecimalField(max_digits=10, decimal_places=2, null=False, blank=False, validators=[nonzero_validator,])
-       object = models.ForeignKey(Object, null=True, blank=True)
+       object = models.ForeignKey(Object, null=True, blank=True, on_delete=models.CASCADE)
        description = models.CharField(max_length=200, null=False, blank=False)
 
        @property
@@ -115,7 +115,7 @@ class JournalItem(models.Model):
                return ""
 
 class JournalUrl(models.Model):
-       journal = models.ForeignKey(JournalEntry, null=False, blank=False)
+       journal = models.ForeignKey(JournalEntry, null=False, blank=False, on_delete=models.CASCADE)
        url = models.URLField(null=False, blank=False)
 
        def __unicode__(self):
index 58a887877b7ef1423e6d858d9b4097e64d1fcd1d..bb38498aa49535cb953492194f3e7f664c939078 100644 (file)
@@ -55,7 +55,7 @@ class Migration(migrations.Migration):
                 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                 ('receivedat', models.DateTimeField(auto_now_add=True)),
                 ('refund_amount', models.IntegerField()),
-                ('notification', models.ForeignKey(to='adyen.Notification')),
+                ('notification', models.ForeignKey(to='adyen.Notification', on_delete=models.CASCADE)),
             ],
         ),
         migrations.CreateModel(
@@ -67,7 +67,7 @@ class Migration(migrations.Migration):
                 ('downloadedat', models.DateTimeField(null=True, blank=True)),
                 ('contents', models.TextField(null=True, blank=True)),
                 ('processedat', models.DateTimeField(null=True, blank=True)),
-                ('notification', models.ForeignKey(to='adyen.Notification')),
+                ('notification', models.ForeignKey(to='adyen.Notification', on_delete=models.CASCADE)),
             ],
         ),
         migrations.CreateModel(
@@ -90,7 +90,7 @@ class Migration(migrations.Migration):
                 ('method', models.CharField(max_length=100, null=True, blank=True)),
                 ('notes', models.CharField(max_length=1000, null=True, blank=True)),
                 ('accounting_object', models.CharField(max_length=30, null=True, blank=True)),
-                ('notification', models.ForeignKey(to='adyen.Notification')),
+                ('notification', models.ForeignKey(to='adyen.Notification', on_delete=models.CASCADE)),
             ],
             options={
                 'verbose_name_plural': 'Transaction statuses',
@@ -99,12 +99,12 @@ class Migration(migrations.Migration):
         migrations.AddField(
             model_name='refund',
             name='transaction',
-            field=models.OneToOneField(to='adyen.TransactionStatus'),
+            field=models.OneToOneField(to='adyen.TransactionStatus', on_delete=models.CASCADE),
         ),
         migrations.AddField(
             model_name='notification',
             name='rawnotification',
-            field=models.ForeignKey(blank=True, to='adyen.RawNotification', null=True),
+            field=models.ForeignKey(blank=True, to='adyen.RawNotification', null=True, on_delete=models.CASCADE),
         ),
         migrations.AlterUniqueTogether(
             name='notification',
index 5f7c6c9ca47fd1b2a5e77d894faf79bb78d7b591..0f1f9083bda3695ebf2d625b3d63359a12c62e6e 100644 (file)
@@ -13,7 +13,7 @@ class RawNotification(models.Model):
 
 class Notification(models.Model):
        receivedat = models.DateTimeField(null=False, blank=False, auto_now_add=True, unique=True)
-       rawnotification = models.ForeignKey(RawNotification, null=True, blank=True)
+       rawnotification = models.ForeignKey(RawNotification, null=True, blank=True, on_delete=models.CASCADE)
        eventDate = models.DateTimeField(null=False, blank=False)
        eventCode = models.CharField(max_length=100, null=False, blank=False)
        live = models.BooleanField(null=False)
@@ -37,7 +37,7 @@ class Notification(models.Model):
 
 class Report(models.Model):
        receivedat = models.DateTimeField(null=False, blank=False, auto_now_add=True)
-       notification = models.ForeignKey(Notification, null=False, blank=False)
+       notification = models.ForeignKey(Notification, null=False, blank=False, on_delete=models.CASCADE)
        url = models.CharField(max_length=1000, null=False, blank=False)
        downloadedat = models.DateTimeField(null=True, blank=True)
        contents = models.TextField(null=True, blank=True)
@@ -45,7 +45,7 @@ class Report(models.Model):
 
 class TransactionStatus(models.Model):
        pspReference = models.CharField(max_length=100, null=False, blank=False, unique=True)
-       notification = models.ForeignKey(Notification, null=False, blank=False)
+       notification = models.ForeignKey(Notification, null=False, blank=False, on_delete=models.CASCADE)
        authorizedat = models.DateTimeField(null=False, blank=False)
        capturedat = models.DateTimeField(null=True, blank=True)
        settledat = models.DateTimeField(null=True, blank=True)
@@ -63,8 +63,8 @@ class TransactionStatus(models.Model):
 
 class Refund(models.Model):
        receivedat = models.DateTimeField(null=False, blank=False, auto_now_add=True)
-       notification = models.ForeignKey(Notification, null=False, blank=False)
-       transaction = models.OneToOneField(TransactionStatus)
+       notification = models.ForeignKey(Notification, null=False, blank=False, on_delete=models.CASCADE)
+       transaction = models.OneToOneField(TransactionStatus, on_delete=models.CASCADE)
        refund_amount = models.DecimalField(decimal_places=2, max_digits=20, null=False)
 
        def __unicode__(self):
index fd6bef0988735b6e1cc87f1eb807f23da118f5c7..e237a76cb58e9eacff8697b6f1f18f76db64f6b8 100644 (file)
@@ -241,8 +241,8 @@ class Migration(migrations.Migration):
             fields=[
                 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                 ('buyername', models.CharField(max_length=100, null=True, blank=True)),
-                ('buyer', models.ForeignKey(to=settings.AUTH_USER_MODEL)),
-                ('conference', models.ForeignKey(to='confreg.Conference')),
+                ('buyer', models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE)),
+                ('conference', models.ForeignKey(to='confreg.Conference', on_delete=models.CASCADE)),
             ],
             options={
                 'ordering': ['conference', 'id'],
@@ -255,8 +255,8 @@ class Migration(migrations.Migration):
                 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                 ('vouchervalue', models.CharField(unique=True, max_length=100)),
                 ('usedate', models.DateTimeField(null=True, blank=True)),
-                ('batch', models.ForeignKey(to='confreg.PrepaidBatch')),
-                ('conference', models.ForeignKey(to='confreg.Conference')),
+                ('batch', models.ForeignKey(to='confreg.PrepaidBatch', on_delete=models.CASCADE)),
+                ('conference', models.ForeignKey(to='confreg.Conference', on_delete=models.CASCADE)),
             ],
             options={
                 'ordering': ['batch', 'vouchervalue'],
@@ -269,7 +269,7 @@ class Migration(migrations.Migration):
                 ('regclass', models.CharField(max_length=64, verbose_name="Registration class")),
                 ('badgecolor', models.CharField(blank=True, verbose_name="Badge color", help_text=b'Badge background color in hex format', max_length=20, validators=[postgresqleu.confreg.models.color_validator])),
                 ('badgeforegroundcolor', models.CharField(blank=True, verbose_name="Badge foreground", help_text=b'Badge foreground color in hex format', max_length=20, validators=[postgresqleu.confreg.models.color_validator])),
-                ('conference', models.ForeignKey(to='confreg.Conference')),
+                ('conference', models.ForeignKey(to='confreg.Conference', on_delete=models.CASCADE)),
             ],
             options={
                 'verbose_name_plural': 'Registration classes',
@@ -280,7 +280,7 @@ class Migration(migrations.Migration):
             fields=[
                 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                 ('day', models.DateField()),
-                ('conference', models.ForeignKey(to='confreg.Conference')),
+                ('conference', models.ForeignKey(to='confreg.Conference', on_delete=models.CASCADE)),
             ],
             options={
                 'ordering': ('day',),
@@ -300,9 +300,9 @@ class Migration(migrations.Migration):
                 ('alertmessage', models.TextField(blank=True)),
                 ('upsell_target', models.BooleanField(default=False, help_text=b'Is target registration type for upselling in order to add additional options')),
                 ('invoice_autocancel_hours', models.IntegerField(blank=True, help_text=b'Automatically cancel invoices after this many hours', null=True, verbose_name=b'Autocancel invoices', validators=[django.core.validators.MinValueValidator(1)])),
-                ('conference', models.ForeignKey(to='confreg.Conference')),
+                ('conference', models.ForeignKey(to='confreg.Conference', on_delete=models.CASCADE)),
                 ('days', models.ManyToManyField(to='confreg.RegistrationDay', blank=True)),
-                ('regclass', models.ForeignKey(blank=True, to='confreg.RegistrationClass', null=True)),
+                ('regclass', models.ForeignKey(blank=True, to='confreg.RegistrationClass', null=True, on_delete=models.CASCADE)),
                 ('requires_option', models.ManyToManyField(help_text=b'Requires at least one of the selected additional options to be picked', to='confreg.ConferenceAdditionalOption', blank=True)),
             ],
             options={
@@ -326,7 +326,7 @@ class Migration(migrations.Migration):
                 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                 ('roomname', models.CharField(max_length=20)),
                 ('sortkey', models.IntegerField(default=100)),
-                ('conference', models.ForeignKey(to='confreg.Conference')),
+                ('conference', models.ForeignKey(to='confreg.Conference', on_delete=models.CASCADE)),
             ],
             options={
                 'ordering': ['sortkey', 'roomname'],
@@ -366,13 +366,13 @@ class Migration(migrations.Migration):
                 ('color', models.CharField(blank=True, max_length=20, validators=[postgresqleu.confreg.models.color_validator])),
                 ('sortkey', models.IntegerField(default=100)),
                 ('incfp', models.BooleanField(default=False)),
-                ('conference', models.ForeignKey(to='confreg.Conference')),
+                ('conference', models.ForeignKey(to='confreg.Conference', on_delete=models.CASCADE)),
             ],
         ),
         migrations.CreateModel(
             name='RegistrationWaitlistEntry',
             fields=[
-                ('registration', models.OneToOneField(primary_key=True, serialize=False, to='confreg.ConferenceRegistration')),
+                ('registration', models.OneToOneField(primary_key=True, serialize=False, to='confreg.ConferenceRegistration', on_delete=models.CASCADE)),
                 ('enteredon', models.DateTimeField(auto_now_add=True)),
                 ('offeredon', models.DateTimeField(null=True, blank=True)),
                 ('offerexpires', models.DateTimeField(null=True, blank=True)),
@@ -381,23 +381,23 @@ class Migration(migrations.Migration):
         migrations.CreateModel(
             name='Speaker_Photo',
             fields=[
-                ('speaker', models.OneToOneField(primary_key=True, db_column=b'id', serialize=False, to='confreg.Speaker')),
+                ('speaker', models.OneToOneField(primary_key=True, db_column=b'id', serialize=False, to='confreg.Speaker', on_delete=models.CASCADE)),
                 ('photo', models.TextField()),
             ],
         ),
         migrations.AddField(
             model_name='speaker',
             name='user',
-            field=models.OneToOneField(null=True, blank=True, to=settings.AUTH_USER_MODEL),
+            field=models.OneToOneField(null=True, blank=True, to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE),
         ),
         migrations.AddField(
             model_name='prepaidvoucher',
             name='user',
-            field=models.ForeignKey(blank=True, to='confreg.ConferenceRegistration', null=True),
+            field=models.ForeignKey(blank=True, to='confreg.ConferenceRegistration', null=True, on_delete=models.CASCADE),
         ),
         migrations.AddField(
             model_name='prepaidbatch',
             name='regtype',
-            field=models.ForeignKey(to='confreg.RegistrationType'),
+            field=models.ForeignKey(to='confreg.RegistrationType', on_delete=models.CASCADE),
         ),
     ]
index 24ddde0ba0ab405b229464e38e8be70f81d8619b..0b399abc91238e51eaf0c7457551d8422673b626 100644 (file)
@@ -19,17 +19,17 @@ class Migration(migrations.Migration):
         migrations.AddField(
             model_name='prepaidbatch',
             name='sponsor',
-            field=models.ForeignKey(verbose_name=b'Optional sponsor', blank=True, to='confsponsor.Sponsor', null=True),
+            field=models.ForeignKey(verbose_name=b'Optional sponsor', blank=True, to='confsponsor.Sponsor', null=True, on_delete=models.CASCADE),
         ),
         migrations.AddField(
             model_name='pendingadditionalorder',
             name='invoice',
-            field=models.ForeignKey(blank=True, to='invoices.Invoice', null=True),
+            field=models.ForeignKey(blank=True, to='invoices.Invoice', null=True, on_delete=models.CASCADE),
         ),
         migrations.AddField(
             model_name='pendingadditionalorder',
             name='newregtype',
-            field=models.ForeignKey(blank=True, to='confreg.RegistrationType', null=True),
+            field=models.ForeignKey(blank=True, to='confreg.RegistrationType', null=True, on_delete=models.CASCADE),
         ),
         migrations.AddField(
             model_name='pendingadditionalorder',
@@ -39,12 +39,12 @@ class Migration(migrations.Migration):
         migrations.AddField(
             model_name='pendingadditionalorder',
             name='reg',
-            field=models.ForeignKey(to='confreg.ConferenceRegistration'),
+            field=models.ForeignKey(to='confreg.ConferenceRegistration', on_delete=models.CASCADE),
         ),
         migrations.AddField(
             model_name='discountcode',
             name='conference',
-            field=models.ForeignKey(to='confreg.Conference'),
+            field=models.ForeignKey(to='confreg.Conference', on_delete=models.CASCADE),
         ),
         migrations.AddField(
             model_name='discountcode',
@@ -64,52 +64,52 @@ class Migration(migrations.Migration):
         migrations.AddField(
             model_name='discountcode',
             name='sponsor',
-            field=models.ForeignKey(blank=True, to='confsponsor.Sponsor', help_text=b'Note that if a sponsor is picked, an invoice will be generated once the discount code closes!!!', null=True, verbose_name=b'Optional sponsor.'),
+            field=models.ForeignKey(blank=True, to='confsponsor.Sponsor', help_text=b'Note that if a sponsor is picked, an invoice will be generated once the discount code closes!!!', null=True, verbose_name=b'Optional sponsor.', on_delete=models.CASCADE),
         ),
         migrations.AddField(
             model_name='discountcode',
             name='sponsor_rep',
-            field=models.ForeignKey(blank=True, to=settings.AUTH_USER_MODEL, help_text=b'Must be set if the sponsor field is set!', null=True, verbose_name=b'Optional sponsor representative.'),
+            field=models.ForeignKey(blank=True, to=settings.AUTH_USER_MODEL, help_text=b'Must be set if the sponsor field is set!', null=True, verbose_name=b'Optional sponsor representative.', on_delete=models.CASCADE),
         ),
         migrations.AddField(
             model_name='conferencesessionvote',
             name='session',
-            field=models.ForeignKey(to='confreg.ConferenceSession'),
+            field=models.ForeignKey(to='confreg.ConferenceSession', on_delete=models.CASCADE),
         ),
         migrations.AddField(
             model_name='conferencesessionvote',
             name='voter',
-            field=models.ForeignKey(to=settings.AUTH_USER_MODEL),
+            field=models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE),
         ),
         migrations.AddField(
             model_name='conferencesessionscheduleslot',
             name='conference',
-            field=models.ForeignKey(to='confreg.Conference'),
+            field=models.ForeignKey(to='confreg.Conference', on_delete=models.CASCADE),
         ),
         migrations.AddField(
             model_name='conferencesessionfeedback',
             name='attendee',
-            field=models.ForeignKey(to=settings.AUTH_USER_MODEL),
+            field=models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE),
         ),
         migrations.AddField(
             model_name='conferencesessionfeedback',
             name='conference',
-            field=models.ForeignKey(to='confreg.Conference'),
+            field=models.ForeignKey(to='confreg.Conference', on_delete=models.CASCADE),
         ),
         migrations.AddField(
             model_name='conferencesessionfeedback',
             name='session',
-            field=models.ForeignKey(to='confreg.ConferenceSession'),
+            field=models.ForeignKey(to='confreg.ConferenceSession', on_delete=models.CASCADE),
         ),
         migrations.AddField(
             model_name='conferencesession',
             name='conference',
-            field=models.ForeignKey(to='confreg.Conference'),
+            field=models.ForeignKey(to='confreg.Conference', on_delete=models.CASCADE),
         ),
         migrations.AddField(
             model_name='conferencesession',
             name='room',
-            field=models.ForeignKey(blank=True, to='confreg.Room', null=True),
+            field=models.ForeignKey(blank=True, to='confreg.Room', null=True, on_delete=models.CASCADE),
         ),
         migrations.AddField(
             model_name='conferencesession',
@@ -119,17 +119,17 @@ class Migration(migrations.Migration):
         migrations.AddField(
             model_name='conferencesession',
             name='tentativeroom',
-            field=models.ForeignKey(related_name='tentativeroom', blank=True, to='confreg.Room', null=True),
+            field=models.ForeignKey(related_name='tentativeroom', blank=True, to='confreg.Room', null=True, on_delete=models.CASCADE),
         ),
         migrations.AddField(
             model_name='conferencesession',
             name='tentativescheduleslot',
-            field=models.ForeignKey(blank=True, to='confreg.ConferenceSessionScheduleSlot', null=True),
+            field=models.ForeignKey(blank=True, to='confreg.ConferenceSessionScheduleSlot', null=True, on_delete=models.CASCADE),
         ),
         migrations.AddField(
             model_name='conferencesession',
             name='track',
-            field=models.ForeignKey(blank=True, to='confreg.Track', null=True),
+            field=models.ForeignKey(blank=True, to='confreg.Track', null=True, on_delete=models.CASCADE),
         ),
         migrations.AddField(
             model_name='conferenceregistration',
@@ -139,62 +139,62 @@ class Migration(migrations.Migration):
         migrations.AddField(
             model_name='conferenceregistration',
             name='attendee',
-            field=models.ForeignKey(to=settings.AUTH_USER_MODEL),
+            field=models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE),
         ),
         migrations.AddField(
             model_name='conferenceregistration',
             name='bulkpayment',
-            field=models.ForeignKey(blank=True, to='confreg.BulkPayment', null=True),
+            field=models.ForeignKey(blank=True, to='confreg.BulkPayment', null=True, on_delete=models.CASCADE),
         ),
         migrations.AddField(
             model_name='conferenceregistration',
             name='conference',
-            field=models.ForeignKey(to='confreg.Conference'),
+            field=models.ForeignKey(to='confreg.Conference', on_delete=models.CASCADE),
         ),
         migrations.AddField(
             model_name='conferenceregistration',
             name='country',
-            field=models.ForeignKey(verbose_name=b'Country', to='countries.Country'),
+            field=models.ForeignKey(verbose_name=b'Country', to='countries.Country', on_delete=models.CASCADE),
         ),
         migrations.AddField(
             model_name='conferenceregistration',
             name='invoice',
-            field=models.ForeignKey(blank=True, to='invoices.Invoice', null=True),
+            field=models.ForeignKey(blank=True, to='invoices.Invoice', null=True, on_delete=models.CASCADE),
         ),
         migrations.AddField(
             model_name='conferenceregistration',
             name='regtype',
-            field=models.ForeignKey(verbose_name=b'Registration type', blank=True, to='confreg.RegistrationType', null=True),
+            field=models.ForeignKey(verbose_name=b'Registration type', blank=True, to='confreg.RegistrationType', null=True, on_delete=models.CASCADE),
         ),
         migrations.AddField(
             model_name='conferenceregistration',
             name='shirtsize',
-            field=models.ForeignKey(verbose_name=b'Preferred T-shirt size', blank=True, to='confreg.ShirtSize', null=True),
+            field=models.ForeignKey(verbose_name=b'Preferred T-shirt size', blank=True, to='confreg.ShirtSize', null=True, on_delete=models.CASCADE),
         ),
         migrations.AddField(
             model_name='conferencefeedbackquestion',
             name='conference',
-            field=models.ForeignKey(to='confreg.Conference'),
+            field=models.ForeignKey(to='confreg.Conference', on_delete=models.CASCADE),
         ),
         migrations.AddField(
             model_name='conferencefeedbackanswer',
             name='attendee',
-            field=models.ForeignKey(to=settings.AUTH_USER_MODEL),
+            field=models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE),
         ),
         migrations.AddField(
             model_name='conferencefeedbackanswer',
             name='conference',
-            field=models.ForeignKey(to='confreg.Conference'),
+            field=models.ForeignKey(to='confreg.Conference', on_delete=models.CASCADE),
         ),
         migrations.AddField(
             model_name='conferencefeedbackanswer',
             name='question',
-            field=models.ForeignKey(to='confreg.ConferenceFeedbackQuestion'),
+            field=models.ForeignKey(to='confreg.ConferenceFeedbackQuestion', on_delete=models.CASCADE),
         ),
         migrations.AddField(
             model_name='conferenceadditionaloption',
             name='conference',
-            field=models.ForeignKey(to='confreg.Conference'),
+            field=models.ForeignKey(to='confreg.Conference', on_delete=models.CASCADE),
         ),
         migrations.AddField(
             model_name='conferenceadditionaloption',
@@ -229,22 +229,22 @@ class Migration(migrations.Migration):
         migrations.AddField(
             model_name='bulkpayment',
             name='conference',
-            field=models.ForeignKey(to='confreg.Conference'),
+            field=models.ForeignKey(to='confreg.Conference', on_delete=models.CASCADE),
         ),
         migrations.AddField(
             model_name='bulkpayment',
             name='invoice',
-            field=models.ForeignKey(blank=True, to='invoices.Invoice', null=True),
+            field=models.ForeignKey(blank=True, to='invoices.Invoice', null=True, on_delete=models.CASCADE),
         ),
         migrations.AddField(
             model_name='bulkpayment',
             name='user',
-            field=models.ForeignKey(to=settings.AUTH_USER_MODEL),
+            field=models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE),
         ),
         migrations.AddField(
             model_name='attendeemail',
             name='conference',
-            field=models.ForeignKey(to='confreg.Conference'),
+            field=models.ForeignKey(to='confreg.Conference', on_delete=models.CASCADE),
         ),
         migrations.AddField(
             model_name='attendeemail',
@@ -254,7 +254,7 @@ class Migration(migrations.Migration):
         migrations.AddField(
             model_name='registrationwaitlisthistory',
             name='waitlist',
-            field=models.ForeignKey(to='confreg.RegistrationWaitlistEntry'),
+            field=models.ForeignKey(to='confreg.RegistrationWaitlistEntry', on_delete=models.CASCADE),
         ),
         migrations.AlterUniqueTogether(
             name='discountcode',
index face8b3bd270b3ca9e4d03610c8f9864632e2370..4ac5986b9b60b0e6f216035e1cb7a63d19309b86 100644 (file)
@@ -15,12 +15,12 @@ class Migration(migrations.Migration):
         migrations.AddField(
             model_name='conference',
             name='vat_registrations',
-            field=models.ForeignKey(related_name='vat_registrations', verbose_name=b'VAT rate for registrations', blank=True, to='invoices.VatRate', null=True),
+            field=models.ForeignKey(related_name='vat_registrations', verbose_name=b'VAT rate for registrations', blank=True, to='invoices.VatRate', null=True, on_delete=models.CASCADE),
         ),
         migrations.AddField(
             model_name='conference',
             name='vat_sponsorship',
-            field=models.ForeignKey(related_name='vat_sponsorship', verbose_name=b'VAT rate for sponsorships', blank=True, to='invoices.VatRate', null=True),
+            field=models.ForeignKey(related_name='vat_sponsorship', verbose_name=b'VAT rate for sponsorships', blank=True, to='invoices.VatRate', null=True, on_delete=models.CASCADE),
         ),
         migrations.AlterField(
             model_name='conferenceadditionaloption',
index 804ad016cef887b8f228254a6d7c592e76c3273b..8861f16b53e93b766bb5df47fc697c623fa35b10 100644 (file)
@@ -44,17 +44,17 @@ class Migration(migrations.Migration):
         migrations.AddField(
             model_name='volunteerslot',
             name='conference',
-            field=models.ForeignKey(to='confreg.Conference'),
+            field=models.ForeignKey(to='confreg.Conference', on_delete=models.CASCADE),
         ),
         migrations.AddField(
             model_name='volunteerassignment',
             name='reg',
-            field=models.ForeignKey(to='confreg.ConferenceRegistration'),
+            field=models.ForeignKey(to='confreg.ConferenceRegistration', on_delete=models.CASCADE),
         ),
         migrations.AddField(
             model_name='volunteerassignment',
             name='slot',
-            field=models.ForeignKey(to='confreg.VolunteerSlot'),
+            field=models.ForeignKey(to='confreg.VolunteerSlot', on_delete=models.CASCADE),
         ),
                migrations.RunSQL(
                        "CREATE INDEX confreg_volunteerslot_timerange_idx ON confreg_volunteerslot USING gist(timerange)",
index 03b0e2bad2aa5ccd2b764f290c97c432fcaa8026..652fb2b7d66053502c35cd3878bda0bc9295a511 100644 (file)
@@ -18,7 +18,7 @@ class Migration(migrations.Migration):
                 ('name', models.CharField(max_length=100)),
                 ('url', models.URLField(blank=True)),
                 ('content', models.BinaryField(null=True)),
-                ('session', models.ForeignKey(to='confreg.ConferenceSession')),
+                ('session', models.ForeignKey(to='confreg.ConferenceSession', on_delete=models.CASCADE)),
             ],
         ),
     ]
index 625be7a7d2091b0d43ce10d3a116b7e5671262b9..faf2ff0913f8f2b18f5ac80b227f554039cf6d3d 100644 (file)
@@ -25,13 +25,13 @@ class Migration(migrations.Migration):
             name='ConferenceSeriesOptOut',
             fields=[
                 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
-                ('series', models.ForeignKey(to='confreg.ConferenceSeries')),
+                ('series', models.ForeignKey(to='confreg.ConferenceSeries', on_delete=models.CASCADE)),
             ],
         ),
         migrations.CreateModel(
             name='GlobalOptOut',
             fields=[
-                ('user', models.OneToOneField(primary_key=True, serialize=False, to=settings.AUTH_USER_MODEL)),
+                ('user', models.OneToOneField(primary_key=True, serialize=False, to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE)),
             ],
         ),
         migrations.AddField(
@@ -42,12 +42,12 @@ class Migration(migrations.Migration):
         migrations.AddField(
             model_name='conferenceseriesoptout',
             name='user',
-            field=models.ForeignKey(to=settings.AUTH_USER_MODEL),
+            field=models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE),
         ),
         migrations.AddField(
             model_name='conference',
             name='series',
-            field=models.ForeignKey(blank=True, to='confreg.ConferenceSeries', null=True),
+            field=models.ForeignKey(blank=True, to='confreg.ConferenceSeries', null=True, on_delete=models.CASCADE),
         ),
         migrations.AlterUniqueTogether(
             name='conferenceseriesoptout',
index 5fa30f6c28536fedb60bb190ce3029d8dab2c875..6491aa4be1fca589d2692a8847d5662ffa7da774 100644 (file)
@@ -14,6 +14,6 @@ class Migration(migrations.Migration):
         migrations.AlterField(
             model_name='conference',
             name='series',
-            field=models.ForeignKey(to='confreg.ConferenceSeries'),
+            field=models.ForeignKey(to='confreg.ConferenceSeries', on_delete=models.CASCADE),
         ),
     ]
index cc7b13dd9993f3ba886018181da60243e1459d34..27eb2ba200a03f53252ee9160aafd848d6c89962 100644 (file)
@@ -16,18 +16,18 @@ class Migration(migrations.Migration):
         migrations.AddField(
             model_name='conferenceregistration',
             name='registrator',
-            field=models.ForeignKey(related_name='registrator', blank=True, null=True, to=settings.AUTH_USER_MODEL),
+            field=models.ForeignKey(related_name='registrator', blank=True, null=True, to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE),
             preserve_default=False,
         ),
         migrations.AlterField(
             model_name='conferenceregistration',
             name='attendee',
-            field=models.ForeignKey(blank=True, to=settings.AUTH_USER_MODEL, null=True),
+            field=models.ForeignKey(blank=True, to=settings.AUTH_USER_MODEL, null=True, on_delete=models.CASCADE),
         ),
                migrations.RunSQL("UPDATE confreg_conferenceregistration SET registrator_id=attendee_id"),
                migrations.AlterField(
             model_name='conferenceregistration',
             name='registrator',
-            field=models.ForeignKey(related_name='registrator', to=settings.AUTH_USER_MODEL),
+            field=models.ForeignKey(related_name='registrator', to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE),
                ),
     ]
index 91805df3a97372eadb82f1032ca6544e22879a8e..0c3c3e74e6c9fa03d262c6e110adb26eabb5f9a7 100644 (file)
@@ -34,17 +34,17 @@ class Migration(migrations.Migration):
         migrations.AddField(
             model_name='aggregatedtshirtsizes',
             name='conference',
-            field=models.ForeignKey(to='confreg.Conference'),
+            field=models.ForeignKey(to='confreg.Conference', on_delete=models.CASCADE),
         ),
         migrations.AddField(
             model_name='aggregatedtshirtsizes',
             name='size',
-            field=models.ForeignKey(to='confreg.ShirtSize'),
+            field=models.ForeignKey(to='confreg.ShirtSize', on_delete=models.CASCADE),
         ),
         migrations.AddField(
             model_name='aggregateddietary',
             name='conference',
-            field=models.ForeignKey(to='confreg.Conference'),
+            field=models.ForeignKey(to='confreg.Conference', on_delete=models.CASCADE),
         ),
         migrations.AlterUniqueTogether(
             name='aggregatedtshirtsizes',
index 0167ffd03b59fa5316e7595b7e847096a0782ab6..8871a515e3579c1932443bdb6a95ff6a8a342441 100644 (file)
@@ -19,7 +19,7 @@ class Migration(migrations.Migration):
                 ('token', models.CharField(max_length=200)),
                 ('description', models.TextField()),
                 ('permissions', postgresqleu.util.forms.ChoiceArrayField(base_field=models.CharField(max_length=32, choices=[(b'regtypes', b'Registration types and counters'), (b'discounts', b'Discount codes'), (b'vouchers', b'Voucher codes'), (b'sponsors', b'Sponsors and counts')]), size=None)),
-                ('conference', models.ForeignKey(to='confreg.Conference')),
+                ('conference', models.ForeignKey(to='confreg.Conference', on_delete=models.CASCADE)),
             ],
         ),
         migrations.AlterUniqueTogether(
index b7e0cf4a4f34c474d55b1aa3f49bcbe23fa605a9..d487c29af427f8f543ccd0f408c1632534f616ab 100644 (file)
@@ -82,8 +82,8 @@ class ConferenceSeries(models.Model):
 
 class ConferenceSeriesOptOut(models.Model):
        # Users opting out of communications about a specific conference
-       series = models.ForeignKey(ConferenceSeries, null=False, blank=False)
-       user = models.ForeignKey(User, null=False, blank=False)
+       series = models.ForeignKey(ConferenceSeries, null=False, blank=False, on_delete=models.CASCADE)
+       user = models.ForeignKey(User, null=False, blank=False, on_delete=models.CASCADE)
 
        class Meta:
                unique_together = (
@@ -92,7 +92,7 @@ class ConferenceSeriesOptOut(models.Model):
 
 class GlobalOptOut(models.Model):
        # Users who are opting out of *all* future communications
-       user = models.OneToOneField(User, null=False, blank=False, primary_key=True)
+       user = models.OneToOneField(User, null=False, blank=False, primary_key=True, on_delete=models.CASCADE)
 
 
 class Conference(models.Model):
@@ -152,11 +152,11 @@ class Conference(models.Model):
        lastmodified = models.DateTimeField(auto_now=True, null=False, blank=False)
        newsjson = models.CharField(max_length=128, blank=True, null=True, default=None)
        accounting_object = models.CharField(max_length=30, blank=True, null=True, verbose_name="Accounting object name")
-       vat_registrations = models.ForeignKey(VatRate, null=True, blank=True, verbose_name='VAT rate for registrations', related_name='vat_registrations')
-       vat_sponsorship = models.ForeignKey(VatRate, null=True, blank=True, verbose_name='VAT rate for sponsorships', related_name='vat_sponsorship')
+       vat_registrations = models.ForeignKey(VatRate, null=True, blank=True, verbose_name='VAT rate for registrations', related_name='vat_registrations', on_delete=models.CASCADE)
+       vat_sponsorship = models.ForeignKey(VatRate, null=True, blank=True, verbose_name='VAT rate for sponsorships', related_name='vat_sponsorship', on_delete=models.CASCADE)
        invoice_autocancel_hours = models.IntegerField(blank=True, null=True, validators=[MinValueValidator(1),], verbose_name="Autocancel invoices", help_text="Automatically cancel invoices after this many hours")
        attendees_before_waitlist = models.IntegerField(blank=False, null=False, default=0, validators=[MinValueValidator(0),], verbose_name="Attendees before waitlist", help_text="Maximum number of attendees before enabling waitlist management. 0 for no waitlist management")
-       series = models.ForeignKey(ConferenceSeries, null=False, blank=False)
+       series = models.ForeignKey(ConferenceSeries, null=False, blank=False, on_delete=models.CASCADE)
        personal_data_purged = models.DateTimeField(null=True, blank=True, help_text="Personal data for registrations for this conference have been purged")
 
        # Attributes that are safe to access in jinja templates
@@ -231,7 +231,7 @@ class Conference(models.Model):
                return cc
 
 class RegistrationClass(models.Model):
-       conference = models.ForeignKey(Conference, null=False)
+       conference = models.ForeignKey(Conference, null=False, on_delete=models.CASCADE)
        regclass = models.CharField(max_length=64, null=False, blank=False, verbose_name="Registration class")
        badgecolor = models.CharField(max_length=20, null=False, blank=True, verbose_name="Badge color", help_text='Badge background color in hex format', validators=[color_validator, ])
        badgeforegroundcolor = models.CharField(max_length=20, null=False, blank=True, verbose_name="Badge foreground", help_text='Badge foreground color in hex format', validators=[color_validator, ])
@@ -271,7 +271,7 @@ class RegistrationClass(models.Model):
                return d
 
 class RegistrationDay(models.Model):
-       conference = models.ForeignKey(Conference, null=False)
+       conference = models.ForeignKey(Conference, null=False, on_delete=models.CASCADE)
        day = models.DateField(null=False, blank=False)
 
        class Meta:
@@ -288,9 +288,9 @@ class RegistrationDay(models.Model):
                return df.format('D jS')
 
 class RegistrationType(models.Model):
-       conference = models.ForeignKey(Conference, null=False)
+       conference = models.ForeignKey(Conference, null=False, on_delete=models.CASCADE)
        regtype = models.CharField(max_length=64, null=False, blank=False)
-       regclass = models.ForeignKey(RegistrationClass, null=True, blank=True)
+       regclass = models.ForeignKey(RegistrationClass, null=True, blank=True, on_delete=models.CASCADE)
        cost = models.DecimalField(decimal_places=2, max_digits=10, null=False, default=0, help_text="Cost excluding VAT.")
        active = models.BooleanField(null=False, blank=False, default=True)
        activeuntil = models.DateField(null=True, blank=True)
@@ -347,7 +347,7 @@ class ShirtSize(models.Model):
                ordering = ('sortkey', 'shirtsize',)
 
 class ConferenceAdditionalOption(models.Model):
-       conference = models.ForeignKey(Conference, null=False, blank=False)
+       conference = models.ForeignKey(Conference, null=False, blank=False, on_delete=models.CASCADE)
        name = models.CharField(max_length=100, null=False, blank=False)
        cost = models.DecimalField(decimal_places=2, max_digits=10, null=False, default=0, help_text="Cost excluding VAT.")
        maxcount = models.IntegerField(null=False)
@@ -381,13 +381,13 @@ class ConferenceAdditionalOption(models.Model):
 
 class BulkPayment(models.Model):
        # User that owns this bulk payment
-       user = models.ForeignKey(User, null=False, blank=False)
+       user = models.ForeignKey(User, null=False, blank=False, on_delete=models.CASCADE)
 
        # We attach it to a specific conference
-       conference = models.ForeignKey(Conference, null=False, blank=False)
+       conference = models.ForeignKey(Conference, null=False, blank=False, on_delete=models.CASCADE)
 
        # Invoice, once one has been created
-       invoice = models.ForeignKey(Invoice, null=True, blank=True)
+       invoice = models.ForeignKey(Invoice, null=True, blank=True, on_delete=models.CASCADE)
        numregs = models.IntegerField(null=False, blank=False)
 
        createdat = models.DateField(null=False, blank=False, auto_now_add=True)
@@ -422,18 +422,18 @@ class BulkPayment(models.Model):
                        self.paidat and 'Paid' or 'Not paid yet')
 
 class ConferenceRegistration(models.Model):
-       conference = models.ForeignKey(Conference, null=False, blank=False)
-       regtype = models.ForeignKey(RegistrationType, null=True, blank=True, verbose_name="Registration type")
-       attendee = models.ForeignKey(User, null=True, blank=True)
-       registrator = models.ForeignKey(User, null=False, blank=False, related_name="registrator")
+       conference = models.ForeignKey(Conference, null=False, blank=False, on_delete=models.CASCADE)
+       regtype = models.ForeignKey(RegistrationType, null=True, blank=True, verbose_name="Registration type", on_delete=models.CASCADE)
+       attendee = models.ForeignKey(User, null=True, blank=True, on_delete=models.CASCADE)
+       registrator = models.ForeignKey(User, null=False, blank=False, related_name="registrator", on_delete=models.CASCADE)
        firstname = models.CharField(max_length=100, null=False, blank=False, verbose_name="First name")
        lastname = models.CharField(max_length=100, null=False, blank=False, verbose_name="Last name")
        email = models.EmailField(null=False, blank=False, verbose_name="E-mail address")
        company = models.CharField(max_length=100, null=False, blank=True, verbose_name="Company")
        address = models.TextField(max_length=200, null=False, blank=True, verbose_name="Address")
-       country = models.ForeignKey(Country, null=False, blank=False, verbose_name="Country")
+       country = models.ForeignKey(Country, null=False, blank=False, verbose_name="Country", on_delete=models.CASCADE)
        phone = models.CharField(max_length=100, null=False, blank=True, verbose_name="Phone number")
-       shirtsize = models.ForeignKey(ShirtSize, null=True, blank=True, verbose_name="Preferred T-shirt size")
+       shirtsize = models.ForeignKey(ShirtSize, null=True, blank=True, verbose_name="Preferred T-shirt size", on_delete=models.CASCADE)
        dietary = models.CharField(max_length=100, null=False, blank=True, verbose_name="Special dietary needs")
        additionaloptions = models.ManyToManyField(ConferenceAdditionalOption, blank=True, verbose_name="Additional options")
        twittername = models.CharField(max_length=100, null=False, blank=True, verbose_name="Twitter account", validators=[TwitterValidator, ])
@@ -449,8 +449,8 @@ class ConferenceRegistration(models.Model):
 
        # If an invoice is generated, link to it here so we can find our
        # way back easily.
-       invoice = models.ForeignKey(Invoice, null=True, blank=True)
-       bulkpayment = models.ForeignKey(BulkPayment, null=True, blank=True)
+       invoice = models.ForeignKey(Invoice, null=True, blank=True, on_delete=models.CASCADE)
+       bulkpayment = models.ForeignKey(BulkPayment, null=True, blank=True, on_delete=models.CASCADE)
 
        # Any voucher codes. This is just used as temporary storage, and as
        # such we don't try to make it a foreign key. Must be re-validated
@@ -544,7 +544,7 @@ class ConferenceRegistration(models.Model):
                return d
 
 class RegistrationWaitlistEntry(models.Model):
-       registration = models.OneToOneField(ConferenceRegistration, primary_key=True)
+       registration = models.OneToOneField(ConferenceRegistration, primary_key=True, on_delete=models.CASCADE)
        enteredon = models.DateTimeField(null=False, blank=False, auto_now_add=True)
        offeredon = models.DateTimeField(null=True, blank=True)
        offerexpires = models.DateTimeField(null=True, blank=True)
@@ -554,7 +554,7 @@ class RegistrationWaitlistEntry(models.Model):
                return self.registrationwaitlisthistory_set.filter(text__startswith='Made offer').count()
 
 class RegistrationWaitlistHistory(models.Model):
-       waitlist = models.ForeignKey(RegistrationWaitlistEntry, null=False, blank=False)
+       waitlist = models.ForeignKey(RegistrationWaitlistEntry, null=False, blank=False, on_delete=models.CASCADE)
        time = models.DateTimeField(null=False, blank=False, auto_now_add=True)
        text = models.CharField(max_length=200, null=False, blank=False)
 
@@ -562,7 +562,7 @@ class RegistrationWaitlistHistory(models.Model):
                ordering = ('-time',)
 
 class Track(models.Model):
-       conference = models.ForeignKey(Conference, null=False, blank=False)
+       conference = models.ForeignKey(Conference, null=False, blank=False, on_delete=models.CASCADE)
        trackname = models.CharField(max_length=100, null=False, blank=False)
        color = models.CharField(max_length=20, null=False, blank=True, validators=[color_validator, ])
        sortkey = models.IntegerField(null=False, default=100, blank=False)
@@ -574,7 +574,7 @@ class Track(models.Model):
                return self.trackname
 
 class Room(models.Model):
-       conference = models.ForeignKey(Conference, null=False, blank=False)
+       conference = models.ForeignKey(Conference, null=False, blank=False, on_delete=models.CASCADE)
        roomname = models.CharField(max_length=20, null=False, blank=False)
        sortkey = models.IntegerField(null=False, blank=False, default=100)
 
@@ -591,7 +591,7 @@ def _get_upload_path(instance, filename):
        return "%s" % instance.id
 
 class Speaker(models.Model):
-       user = models.OneToOneField(User, null=True, blank=True, unique=True)
+       user = models.OneToOneField(User, null=True, blank=True, unique=True, on_delete=models.CASCADE)
        fullname = models.CharField(max_length=100, null=False, blank=False)
        twittername = models.CharField(max_length=32, null=False, blank=True)
        company = models.CharField(max_length=100, null=False, blank=True)
@@ -634,7 +634,7 @@ class DeletedItems(models.Model):
        deltime = models.DateTimeField(blank=False, null=False)
 
 class Speaker_Photo(models.Model):
-       speaker = models.OneToOneField(Speaker, db_column='id', primary_key=True)
+       speaker = models.OneToOneField(Speaker, db_column='id', primary_key=True, on_delete=models.CASCADE)
        photo = models.TextField(null=False, blank=False)
 
        def __unicode__(self):
@@ -647,7 +647,7 @@ class Speaker_Photo(models.Model):
                super(Speaker_Photo, self).delete()
 
 class ConferenceSessionScheduleSlot(models.Model):
-       conference = models.ForeignKey(Conference, null=False, blank=False)
+       conference = models.ForeignKey(Conference, null=False, blank=False, on_delete=models.CASCADE)
        starttime = models.DateTimeField(null=False, blank=False)
        endtime = models.DateTimeField(null=False, blank=False)
 
@@ -655,13 +655,13 @@ class ConferenceSessionScheduleSlot(models.Model):
                return "%s - %s" % (self.starttime, self.endtime)
 
 class ConferenceSession(models.Model):
-       conference = models.ForeignKey(Conference, null=False, blank=False)
+       conference = models.ForeignKey(Conference, null=False, blank=False, on_delete=models.CASCADE)
        speaker = models.ManyToManyField(Speaker, blank=True)
        title = models.CharField(max_length=200, null=False, blank=False)
        starttime = models.DateTimeField(null=True, blank=True)
        endtime = models.DateTimeField(null=True, blank=True)
-       track = models.ForeignKey(Track, null=True, blank=True)
-       room = models.ForeignKey(Room, null=True, blank=True)
+       track = models.ForeignKey(Track, null=True, blank=True, on_delete=models.CASCADE)
+       room = models.ForeignKey(Room, null=True, blank=True, on_delete=models.CASCADE)
        cross_schedule = models.BooleanField(null=False, default=False)
        can_feedback = models.BooleanField(null=False, default=True)
        abstract = models.TextField(null=False, blank=True)
@@ -671,8 +671,8 @@ class ConferenceSession(models.Model):
        lastnotifiedtime = models.DateTimeField(null=True, blank=True, verbose_name="Notification last sent")
        submissionnote = models.TextField(null=False, blank=True, verbose_name="Submission notes")
        initialsubmit = models.DateTimeField(null=True, blank=True, verbose_name="Submitted")
-       tentativescheduleslot = models.ForeignKey(ConferenceSessionScheduleSlot, null=True, blank=True)
-       tentativeroom = models.ForeignKey(Room, null=True, blank=True, related_name='tentativeroom')
+       tentativescheduleslot = models.ForeignKey(ConferenceSessionScheduleSlot, null=True, blank=True, on_delete=models.CASCADE)
+       tentativeroom = models.ForeignKey(Room, null=True, blank=True, related_name='tentativeroom', on_delete=models.CASCADE)
        lastmodified = models.DateTimeField(auto_now=True, null=False, blank=False)
 
        # NOTE! Any added fields need to be considered for inclusion in
@@ -737,7 +737,7 @@ class ConferenceSession(models.Model):
                ordering = [ 'starttime', ]
 
 class ConferenceSessionSlides(models.Model):
-       session = models.ForeignKey(ConferenceSession, null=False, blank=False)
+       session = models.ForeignKey(ConferenceSession, null=False, blank=False, on_delete=models.CASCADE)
        name = models.CharField(max_length=100, null=False, blank=False)
        url = models.URLField(max_length=1000, null=False, blank=True)
        content = models.BinaryField(null=True, blank=False)
@@ -745,8 +745,8 @@ class ConferenceSessionSlides(models.Model):
        _safe_attributes = ('id', 'name', 'url', 'content')
 
 class ConferenceSessionVote(models.Model):
-       session = models.ForeignKey(ConferenceSession, null=False, blank=False)
-       voter = models.ForeignKey(User, null=False, blank=False)
+       session = models.ForeignKey(ConferenceSession, null=False, blank=False, on_delete=models.CASCADE)
+       voter = models.ForeignKey(User, null=False, blank=False, on_delete=models.CASCADE)
        vote = models.IntegerField(null=True, blank=False)
        comment = models.TextField(null=True, blank=True)
 
@@ -754,9 +754,9 @@ class ConferenceSessionVote(models.Model):
                unique_together = ( ('session', 'voter',), )
 
 class ConferenceSessionFeedback(models.Model):
-       conference = models.ForeignKey(Conference, null=False, blank=False)
-       session = models.ForeignKey(ConferenceSession, null=False, blank=False)
-       attendee = models.ForeignKey(User, null=False, blank=False)
+       conference = models.ForeignKey(Conference, null=False, blank=False, on_delete=models.CASCADE)
+       session = models.ForeignKey(ConferenceSession, null=False, blank=False, on_delete=models.CASCADE)
+       attendee = models.ForeignKey(User, null=False, blank=False, on_delete=models.CASCADE)
        topic_importance = models.IntegerField(null=False, blank=False)
        content_quality = models.IntegerField(null=False, blank=False)
        speaker_knowledge = models.IntegerField(null=False, blank=False)
@@ -768,7 +768,7 @@ class ConferenceSessionFeedback(models.Model):
                return unicode("%s - %s (%s)") % (self.conference, self.session, self.attendee)
 
 class ConferenceFeedbackQuestion(models.Model):
-       conference = models.ForeignKey(Conference, null=False, blank=False)
+       conference = models.ForeignKey(Conference, null=False, blank=False, on_delete=models.CASCADE)
        question = models.CharField(max_length=100, null=False, blank=False)
        isfreetext = models.BooleanField(blank=False, null=False, default=False)
        textchoices = models.CharField(max_length=500, null=False, blank=True)
@@ -782,9 +782,9 @@ class ConferenceFeedbackQuestion(models.Model):
                ordering = ['conference', 'sortkey', ]
 
 class ConferenceFeedbackAnswer(models.Model):
-       conference = models.ForeignKey(Conference, null=False, blank=False)
-       question = models.ForeignKey(ConferenceFeedbackQuestion, null=False, blank=False)
-       attendee = models.ForeignKey(User, null=False, blank=False)
+       conference = models.ForeignKey(Conference, null=False, blank=False, on_delete=models.CASCADE)
+       question = models.ForeignKey(ConferenceFeedbackQuestion, null=False, blank=False, on_delete=models.CASCADE)
+       attendee = models.ForeignKey(User, null=False, blank=False, on_delete=models.CASCADE)
        rateanswer = models.IntegerField(null=True)
        textanswer = models.TextField(null=False, blank=True)
 
@@ -795,7 +795,7 @@ class ConferenceFeedbackAnswer(models.Model):
                ordering = ['conference', 'attendee', 'question', ]
 
 class VolunteerSlot(models.Model):
-       conference = models.ForeignKey(Conference, null=False, blank=False)
+       conference = models.ForeignKey(Conference, null=False, blank=False, on_delete=models.CASCADE)
        timerange = DateTimeRangeField(null=False, blank=False)
        title = models.CharField(max_length=50, null=False, blank=False)
        min_staff = models.IntegerField(null=False, blank=False, default=1, validators=[MinValueValidator(1)])
@@ -832,19 +832,19 @@ class VolunteerSlot(models.Model):
                return self._localtz.localize(time).astimezone(pytz.utc)
 
 class VolunteerAssignment(models.Model):
-       slot = models.ForeignKey(VolunteerSlot, null=False, blank=False)
-       reg = models.ForeignKey(ConferenceRegistration, null=False, blank=False)
+       slot = models.ForeignKey(VolunteerSlot, null=False, blank=False, on_delete=models.CASCADE)
+       reg = models.ForeignKey(ConferenceRegistration, null=False, blank=False, on_delete=models.CASCADE)
        vol_confirmed = models.BooleanField(null=False, blank=False, default=False, verbose_name="Confirmed by volunteer")
        org_confirmed = models.BooleanField(null=False, blank=False, default=False, verbose_name="Confirmed by organizers")
 
        _safe_attributes = ('id', 'slot', 'reg', 'vol_confirmed', 'org_confirmed')
 
 class PrepaidBatch(models.Model):
-       conference = models.ForeignKey(Conference, null=False, blank=False)
-       regtype = models.ForeignKey(RegistrationType, null=False, blank=False)
-       buyer = models.ForeignKey(User, null=False, blank=False)
+       conference = models.ForeignKey(Conference, null=False, blank=False, on_delete=models.CASCADE)
+       regtype = models.ForeignKey(RegistrationType, null=False, blank=False, on_delete=models.CASCADE)
+       buyer = models.ForeignKey(User, null=False, blank=False, on_delete=models.CASCADE)
        buyername = models.CharField(max_length=100, null=True, blank=True)
-       sponsor = models.ForeignKey('confsponsor.Sponsor', null=True, blank=True, verbose_name="Optional sponsor")
+       sponsor = models.ForeignKey('confsponsor.Sponsor', null=True, blank=True, verbose_name="Optional sponsor", on_delete=models.CASCADE)
 
        def __unicode__(self):
                return "%s: %s for %s" % (self.conference, self.regtype, self.buyer)
@@ -854,10 +854,10 @@ class PrepaidBatch(models.Model):
                ordering = ['conference', 'id', ]
 
 class PrepaidVoucher(models.Model):
-       conference = models.ForeignKey(Conference, null=False, blank=False)
+       conference = models.ForeignKey(Conference, null=False, blank=False, on_delete=models.CASCADE)
        vouchervalue = models.CharField(max_length=100, null=False, blank=False, unique=True)
-       batch = models.ForeignKey(PrepaidBatch, null=False, blank=False)
-       user = models.ForeignKey(ConferenceRegistration, null=True, blank=True)
+       batch = models.ForeignKey(PrepaidBatch, null=False, blank=False, on_delete=models.CASCADE)
+       user = models.ForeignKey(ConferenceRegistration, null=True, blank=True, on_delete=models.CASCADE)
        usedate = models.DateTimeField(null=True, blank=True)
 
        def __unicode__(self):
@@ -867,7 +867,7 @@ class PrepaidVoucher(models.Model):
                ordering = ['batch', 'vouchervalue', ]
 
 class DiscountCode(models.Model):
-       conference = models.ForeignKey(Conference, null=False, blank=False)
+       conference = models.ForeignKey(Conference, null=False, blank=False, on_delete=models.CASCADE)
        code = models.CharField(max_length=100, null=False, blank=False)
        discountamount = models.DecimalField(decimal_places=2, max_digits=10, null=False, default=0)
        discountpercentage = models.IntegerField(null=False, blank=False, default=0)
@@ -880,8 +880,8 @@ class DiscountCode(models.Model):
        registrations = models.ManyToManyField(ConferenceRegistration, blank=True)
 
        # If this discount code is purchased by a sponsor, track it here.
-       sponsor = models.ForeignKey('confsponsor.Sponsor', null=True, blank=True, verbose_name="Optional sponsor.", help_text="Note that if a sponsor is picked, an invoice will be generated once the discount code closes!!!")
-       sponsor_rep = models.ForeignKey(User, null=True, blank=True, verbose_name="Optional sponsor representative.", help_text="Must be set if the sponsor field is set!")
+       sponsor = models.ForeignKey('confsponsor.Sponsor', null=True, blank=True, verbose_name="Optional sponsor.", help_text="Note that if a sponsor is picked, an invoice will be generated once the discount code closes!!!", on_delete=models.CASCADE)
+       sponsor_rep = models.ForeignKey(User, null=True, blank=True, verbose_name="Optional sponsor representative.", help_text="Must be set if the sponsor field is set!", on_delete=models.CASCADE)
        is_invoiced = models.BooleanField(null=False, blank=False, default=False, verbose_name="Has an invoice been sent for this discount code.")
 
        def __unicode__(self):
@@ -896,7 +896,7 @@ class DiscountCode(models.Model):
                return self.registrations.count()
 
 class AttendeeMail(models.Model):
-       conference = models.ForeignKey(Conference, null=False, blank=False)
+       conference = models.ForeignKey(Conference, null=False, blank=False, on_delete=models.CASCADE)
        regclasses = models.ManyToManyField(RegistrationClass, blank=False)
        sentat = models.DateTimeField(null=False, blank=False, auto_now_add=True)
        subject = models.CharField(max_length=100, null=False, blank=False)
@@ -910,11 +910,11 @@ class AttendeeMail(models.Model):
 
 
 class PendingAdditionalOrder(models.Model):
-       reg = models.ForeignKey(ConferenceRegistration, null=False, blank=False)
+       reg = models.ForeignKey(ConferenceRegistration, null=False, blank=False, on_delete=models.CASCADE)
        options = models.ManyToManyField(ConferenceAdditionalOption, blank=False)
-       newregtype = models.ForeignKey(RegistrationType, null=True, blank=True)
+       newregtype = models.ForeignKey(RegistrationType, null=True, blank=True, on_delete=models.CASCADE)
        createtime = models.DateTimeField(null=False, blank=False)
-       invoice = models.ForeignKey(Invoice, null=True, blank=True)
+       invoice = models.ForeignKey(Invoice, null=True, blank=True, on_delete=models.CASCADE)
        payconfirmedat = models.DateTimeField(null=True, blank=True)
 
        def __unicode__(self):
@@ -923,15 +923,15 @@ class PendingAdditionalOrder(models.Model):
 
 
 class AggregatedTshirtSizes(models.Model):
-       conference = models.ForeignKey(Conference, null=False, blank=False)
-       size = models.ForeignKey(ShirtSize, null=False, blank=False)
+       conference = models.ForeignKey(Conference, null=False, blank=False, on_delete=models.CASCADE)
+       size = models.ForeignKey(ShirtSize, null=False, blank=False, on_delete=models.CASCADE)
        num = models.IntegerField(null=False, blank=False)
 
        class Meta:
                unique_together = ( ('conference', 'size'), )
 
 class AggregatedDietary(models.Model):
-       conference = models.ForeignKey(Conference, null=False, blank=False)
+       conference = models.ForeignKey(Conference, null=False, blank=False, on_delete=models.CASCADE)
        dietary = models.CharField(max_length=100, null=False, blank=False)
        num = models.IntegerField(null=False, blank=False)
 
@@ -947,7 +947,7 @@ AccessTokenPermissions = (
 )
 
 class AccessToken(models.Model):
-       conference = models.ForeignKey(Conference, null=False, blank=False)
+       conference = models.ForeignKey(Conference, null=False, blank=False, on_delete=models.CASCADE)
        token = models.CharField(max_length=200, null=False, blank=False)
        description = models.TextField(null=False, blank=False)
        permissions = ChoiceArrayField(
index 484d7d4c23bdc38ba48e52378ae10cea025b5372..6615db87bbbe55c7940ab6053f6c89ace36a8777 100644 (file)
@@ -21,9 +21,9 @@ class Migration(migrations.Migration):
             fields=[
                 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                 ('num', models.IntegerField()),
-                ('batch', models.ForeignKey(blank=True, to='confreg.PrepaidBatch', null=True)),
-                ('invoice', models.ForeignKey(to='invoices.Invoice')),
-                ('regtype', models.ForeignKey(to='confreg.RegistrationType')),
+                ('batch', models.ForeignKey(blank=True, to='confreg.PrepaidBatch', null=True, on_delete=models.CASCADE)),
+                ('invoice', models.ForeignKey(to='invoices.Invoice', on_delete=models.CASCADE)),
+                ('regtype', models.ForeignKey(to='confreg.RegistrationType', on_delete=models.CASCADE)),
             ],
         ),
         migrations.CreateModel(
@@ -36,8 +36,8 @@ class Migration(migrations.Migration):
                 ('confirmed', models.BooleanField(default=False)),
                 ('confirmedat', models.DateTimeField(null=True, blank=True)),
                 ('confirmedby', models.CharField(max_length=50, blank=True)),
-                ('conference', models.ForeignKey(to='confreg.Conference')),
-                ('invoice', models.ForeignKey(blank=True, to='invoices.Invoice', null=True)),
+                ('conference', models.ForeignKey(to='confreg.Conference', on_delete=models.CASCADE)),
+                ('invoice', models.ForeignKey(blank=True, to='invoices.Invoice', null=True, on_delete=models.CASCADE)),
             ],
         ),
         migrations.CreateModel(
@@ -57,7 +57,7 @@ class Migration(migrations.Migration):
                 ('sentat', models.DateTimeField(auto_now_add=True)),
                 ('subject', models.CharField(max_length=100)),
                 ('message', models.TextField(max_length=8000)),
-                ('conference', models.ForeignKey(to='confreg.Conference')),
+                ('conference', models.ForeignKey(to='confreg.Conference', on_delete=models.CASCADE)),
             ],
             options={
                 'ordering': ('-sentat',),
@@ -97,8 +97,8 @@ class Migration(migrations.Migration):
                 ('instantbuy', models.BooleanField(default=False, verbose_name="Instant buy available")),
                 ('canbuyvoucher', models.BooleanField(default=True, verbose_name="Can buy vouchers")),
                 ('canbuydiscountcode', models.BooleanField(default=True, verbose_name="Can buy discount codes")),
-                ('conference', models.ForeignKey(to='confreg.Conference')),
-                ('contract', models.ForeignKey(blank=True, to='confsponsor.SponsorshipContract', null=True)),
+                ('conference', models.ForeignKey(to='confreg.Conference', on_delete=models.CASCADE)),
+                ('contract', models.ForeignKey(blank=True, to='confsponsor.SponsorshipContract', null=True, on_delete=models.CASCADE)),
                 ('paymentmethods', models.ManyToManyField(to='invoices.InvoicePaymentMethod', verbose_name=b'Payment methods for generated invoices')),
             ],
             options={
@@ -108,7 +108,7 @@ class Migration(migrations.Migration):
         migrations.AddField(
             model_name='sponsorshipbenefit',
             name='level',
-            field=models.ForeignKey(to='confsponsor.SponsorshipLevel'),
+            field=models.ForeignKey(to='confsponsor.SponsorshipLevel', on_delete=models.CASCADE),
         ),
         migrations.AddField(
             model_name='sponsormail',
@@ -118,22 +118,22 @@ class Migration(migrations.Migration):
         migrations.AddField(
             model_name='sponsorclaimedbenefit',
             name='benefit',
-            field=models.ForeignKey(to='confsponsor.SponsorshipBenefit'),
+            field=models.ForeignKey(to='confsponsor.SponsorshipBenefit', on_delete=models.CASCADE),
         ),
         migrations.AddField(
             model_name='sponsorclaimedbenefit',
             name='claimedby',
-            field=models.ForeignKey(to=settings.AUTH_USER_MODEL),
+            field=models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE),
         ),
         migrations.AddField(
             model_name='sponsorclaimedbenefit',
             name='sponsor',
-            field=models.ForeignKey(to='confsponsor.Sponsor'),
+            field=models.ForeignKey(to='confsponsor.Sponsor', on_delete=models.CASCADE),
         ),
         migrations.AddField(
             model_name='sponsor',
             name='level',
-            field=models.ForeignKey(to='confsponsor.SponsorshipLevel'),
+            field=models.ForeignKey(to='confsponsor.SponsorshipLevel', on_delete=models.CASCADE),
         ),
         migrations.AddField(
             model_name='sponsor',
@@ -143,12 +143,12 @@ class Migration(migrations.Migration):
         migrations.AddField(
             model_name='purchasedvoucher',
             name='sponsor',
-            field=models.ForeignKey(to='confsponsor.Sponsor'),
+            field=models.ForeignKey(to='confsponsor.Sponsor', on_delete=models.CASCADE),
         ),
         migrations.AddField(
             model_name='purchasedvoucher',
             name='user',
-            field=models.ForeignKey(to=settings.AUTH_USER_MODEL),
+            field=models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE),
         ),
         migrations.AlterUniqueTogether(
             name='sponsorshiplevel',
index 4455532756ff1f2988c8d9dbb58bc4f0c496341d..c578a22c3c13213fa021eb25658555101c6549ca 100644 (file)
@@ -15,12 +15,12 @@ class Migration(migrations.Migration):
         migrations.AddField(
             model_name='sponsorshipcontract',
             name='conference',
-            field=models.ForeignKey(to='confreg.Conference', null=True),
+            field=models.ForeignKey(to='confreg.Conference', null=True, on_delete=models.CASCADE),
         ),
         migrations.RunSQL("UPDATE confsponsor_sponsorshipcontract c SET conference_id=(SELECT conference_id FROM confsponsor_sponsorshiplevel l WHERE l.contract_id=c.id LIMIT 1)"),
         migrations.AlterField(
             model_name='sponsorshipcontract',
             name='conference',
-            field=models.ForeignKey(to='confreg.Conference', null=False),
+            field=models.ForeignKey(to='confreg.Conference', null=False, on_delete=models.CASCADE),
         ),
     ]
index 3f39162b2a012dc5ad26651a13e05ac028b4e7c1..51c3ce1c20fe8c29ee91d50b60c6c0e48c7f48ed 100644 (file)
@@ -21,7 +21,7 @@ vat_status_choices = (
 )
 
 class SponsorshipContract(models.Model):
-       conference = models.ForeignKey(Conference, null=False, blank=False)
+       conference = models.ForeignKey(Conference, null=False, blank=False, on_delete=models.CASCADE)
        contractname = models.CharField(max_length=100, null=False, blank=False, verbose_name='Contract name')
        contractpdf = FileField(null=False, blank=True, storage=InlineEncodedStorage('sponsorcontract'), upload_to=inlineencoded_upload_path, verbose_name='Contract PDF')
 
@@ -41,14 +41,14 @@ class SponsorshipContract(models.Model):
 pre_delete.connect(delete_inline_storage, sender=SponsorshipContract)
 
 class SponsorshipLevel(models.Model):
-       conference = models.ForeignKey(Conference, null=False, blank=False)
+       conference = models.ForeignKey(Conference, null=False, blank=False, on_delete=models.CASCADE)
        levelname = models.CharField(max_length=100, null=False, blank=False)
        urlname = models.CharField(max_length=100, null=False, blank=False, validators=[validate_lowercase,])
        levelcost = models.IntegerField(null=False, blank=False)
        available = models.BooleanField(null=False, blank=False, default=True, verbose_name="Available for signup")
        instantbuy = models.BooleanField(null=False, blank=False, default=False, verbose_name="Instant buy available")
        paymentmethods = models.ManyToManyField(InvoicePaymentMethod, blank=False, verbose_name="Payment methods for generated invoices")
-       contract = models.ForeignKey(SponsorshipContract, blank=True, null=True)
+       contract = models.ForeignKey(SponsorshipContract, blank=True, null=True, on_delete=models.CASCADE)
        canbuyvoucher = models.BooleanField(null=False, blank=False, default=True, verbose_name="Can buy vouchers")
        canbuydiscountcode = models.BooleanField(null=False, blank=False, default=True, verbose_name="Can buy discount codes")
 
@@ -60,7 +60,7 @@ class SponsorshipLevel(models.Model):
                unique_together = (('conference', 'urlname'), )
 
 class SponsorshipBenefit(models.Model):
-       level = models.ForeignKey(SponsorshipLevel, null=False, blank=False)
+       level = models.ForeignKey(SponsorshipLevel, null=False, blank=False, on_delete=models.CASCADE)
        benefitname = models.CharField(max_length=100, null=False, blank=False)
        sortkey = models.PositiveIntegerField(null=False, blank=False, default=100)
        benefitdescription = models.TextField(null=False, blank=True)
@@ -75,7 +75,7 @@ class SponsorshipBenefit(models.Model):
                ordering = ('sortkey', 'benefitname', )
 
 class Sponsor(models.Model):
-       conference = models.ForeignKey(Conference, null=False, blank=False)
+       conference = models.ForeignKey(Conference, null=False, blank=False, on_delete=models.CASCADE)
        name = models.CharField(max_length=100, null=False, blank=False)
        displayname = models.CharField(max_length=100, null=False, blank=False)
        invoiceaddr = models.TextField(max_length=500, null=False, blank=True)
@@ -84,8 +84,8 @@ class Sponsor(models.Model):
        managers = models.ManyToManyField(User, blank=False)
        url = models.URLField(max_length=200, null=False, blank=True)
        twittername = models.CharField(max_length=100, null=False, blank=True)
-       level = models.ForeignKey(SponsorshipLevel, null=False, blank=False)
-       invoice = models.ForeignKey(Invoice, null=True, blank=True)
+       level = models.ForeignKey(SponsorshipLevel, null=False, blank=False, on_delete=models.CASCADE)
+       invoice = models.ForeignKey(Invoice, null=True, blank=True, on_delete=models.CASCADE)
        confirmed = models.BooleanField(null=False, blank=False, default=False)
        confirmedat = models.DateTimeField(null=True, blank=True)
        confirmedby = models.CharField(max_length=50, null=False, blank=True)
@@ -95,10 +95,10 @@ class Sponsor(models.Model):
                return self.name
 
 class SponsorClaimedBenefit(models.Model):
-       sponsor = models.ForeignKey(Sponsor, null=False, blank=False)
-       benefit = models.ForeignKey(SponsorshipBenefit, null=False, blank=False)
+       sponsor = models.ForeignKey(Sponsor, null=False, blank=False, on_delete=models.CASCADE)
+       benefit = models.ForeignKey(SponsorshipBenefit, null=False, blank=False, on_delete=models.CASCADE)
        claimedat = models.DateTimeField(null=False, blank=False)
-       claimedby = models.ForeignKey(User, null=False, blank=False)
+       claimedby = models.ForeignKey(User, null=False, blank=False, on_delete=models.CASCADE)
        declined = models.BooleanField(null=False, blank=False, default=False)
        claimdata = models.TextField(max_length=500, blank=True, null=False)
        confirmed = models.BooleanField(null=False, blank=False, default=False)
@@ -107,7 +107,7 @@ class SponsorClaimedBenefit(models.Model):
                unique_together = (('sponsor', 'benefit'),)
 
 class SponsorMail(models.Model):
-       conference = models.ForeignKey(Conference, null=False, blank=False)
+       conference = models.ForeignKey(Conference, null=False, blank=False, on_delete=models.CASCADE)
        levels = models.ManyToManyField(SponsorshipLevel, blank=False)
        sentat = models.DateTimeField(null=False, blank=False, auto_now_add=True)
        subject = models.CharField(max_length=100, null=False, blank=False)
@@ -120,9 +120,9 @@ class SponsorMail(models.Model):
                ordering = ('-sentat',)
 
 class PurchasedVoucher(models.Model):
-       sponsor = models.ForeignKey(Sponsor, null=False, blank=False)
-       user = models.ForeignKey(User, null=False, blank=False)
-       regtype = models.ForeignKey(RegistrationType, null=False, blank=False)
+       sponsor = models.ForeignKey(Sponsor, null=False, blank=False, on_delete=models.CASCADE)
+       user = models.ForeignKey(User, null=False, blank=False, on_delete=models.CASCADE)
+       regtype = models.ForeignKey(RegistrationType, null=False, blank=False, on_delete=models.CASCADE)
        num = models.IntegerField(null=False, blank=False)
-       invoice = models.ForeignKey(Invoice, null=False, blank=False)
-       batch = models.ForeignKey(PrepaidBatch, null=True, blank=True)
+       invoice = models.ForeignKey(Invoice, null=False, blank=False, on_delete=models.CASCADE)
+       batch = models.ForeignKey(PrepaidBatch, null=True, blank=True, on_delete=models.CASCADE)
index f8000aecb096935e02380eda4b6047a7a0f489b3..47743c8dbf8d274772ff7f5efa7cc3ff14efb9dc 100644 (file)
@@ -20,7 +20,7 @@ class Migration(migrations.Migration):
                 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                 ('choice', models.CharField(max_length=100, blank=True)),
                 ('saved', models.DateTimeField(auto_now=True)),
-                ('attendee', models.ForeignKey(to='confreg.ConferenceRegistration')),
+                ('attendee', models.ForeignKey(to='confreg.ConferenceRegistration', on_delete=models.CASCADE)),
             ],
         ),
         migrations.CreateModel(
@@ -35,8 +35,8 @@ class Migration(migrations.Migration):
                 ('public', models.BooleanField(default=False, help_text=b'All attendees can sign up')),
                 ('visible', models.BooleanField(default=False, help_text=b'Show who have signed up to all invited attendees')),
                 ('attendees', models.ManyToManyField(related_name='user_attendees', verbose_name=b'Available to attendees', to='confreg.ConferenceRegistration', blank=True)),
-                ('author', models.ForeignKey(to='confreg.ConferenceRegistration')),
-                ('conference', models.ForeignKey(to='confreg.Conference')),
+                ('author', models.ForeignKey(to='confreg.ConferenceRegistration', on_delete=models.CASCADE)),
+                ('conference', models.ForeignKey(to='confreg.Conference', on_delete=models.CASCADE)),
                 ('regtypes', models.ManyToManyField(related_name='user_regtypes', verbose_name=b'Available to registration types', to='confreg.RegistrationType', blank=True)),
             ],
             options={
@@ -54,8 +54,8 @@ class Migration(migrations.Migration):
                 ('publicview', models.BooleanField(default=False, help_text=b'Can all confirmed attendees see this page?', verbose_name=b'Public view')),
                 ('publicedit', models.BooleanField(default=False, help_text=b'Can all confirmed attendees edit this page?', verbose_name=b'Public edit')),
                 ('history', models.BooleanField(default=True, help_text=b'Can users view the history?')),
-                ('author', models.ForeignKey(to='confreg.ConferenceRegistration')),
-                ('conference', models.ForeignKey(to='confreg.Conference')),
+                ('author', models.ForeignKey(to='confreg.ConferenceRegistration', on_delete=models.CASCADE)),
+                ('conference', models.ForeignKey(to='confreg.Conference', on_delete=models.CASCADE)),
                 ('editor_attendee', models.ManyToManyField(related_name='editor_attendees', verbose_name=b'Editor attendees', to='confreg.ConferenceRegistration', blank=True)),
                 ('editor_regtype', models.ManyToManyField(related_name='editor_regtypes', verbose_name=b'Editor registration types', to='confreg.RegistrationType', blank=True)),
                 ('viewer_attendee', models.ManyToManyField(related_name='viewer_attendees', verbose_name=b'Viewer attendees', to='confreg.ConferenceRegistration', blank=True)),
@@ -72,8 +72,8 @@ class Migration(migrations.Migration):
                 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                 ('publishedat', models.DateTimeField()),
                 ('contents', models.TextField()),
-                ('author', models.ForeignKey(to='confreg.ConferenceRegistration')),
-                ('page', models.ForeignKey(to='confwiki.Wikipage')),
+                ('author', models.ForeignKey(to='confreg.ConferenceRegistration', on_delete=models.CASCADE)),
+                ('page', models.ForeignKey(to='confwiki.Wikipage', on_delete=models.CASCADE)),
             ],
             options={
                 'ordering': ('-publishedat',),
@@ -83,14 +83,14 @@ class Migration(migrations.Migration):
             name='WikipageSubscriber',
             fields=[
                 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
-                ('page', models.ForeignKey(to='confwiki.Wikipage')),
-                ('subscriber', models.ForeignKey(to='confreg.ConferenceRegistration')),
+                ('page', models.ForeignKey(to='confwiki.Wikipage', on_delete=models.CASCADE)),
+                ('subscriber', models.ForeignKey(to='confreg.ConferenceRegistration', on_delete=models.CASCADE)),
             ],
         ),
         migrations.AddField(
             model_name='attendeesignup',
             name='signup',
-            field=models.ForeignKey(to='confwiki.Signup'),
+            field=models.ForeignKey(to='confwiki.Signup', on_delete=models.CASCADE),
         ),
         migrations.AlterUniqueTogether(
             name='wikipagehistory',
index bbb872e9aeaab9e3a5a3e3164a4b61ca7db7ed9b..b2a2a749108f6d44dffd2ec08f8ed191d1e49f15 100644 (file)
@@ -8,12 +8,12 @@ from postgresqleu.confreg.models import RegistrationType
 from postgresqleu.util.diffablemodel import DiffableModel
 
 class Wikipage(models.Model, DiffableModel):
-       conference = models.ForeignKey(Conference, null=False, blank=False)
+       conference = models.ForeignKey(Conference, null=False, blank=False, on_delete=models.CASCADE)
        url = models.CharField(max_length=100, null=False, blank=False, validators=[
                RegexValidator(regex='^[a-zA-Z0-9_-]+$',
                                           message='Invalid character in urlname. Only alphanumerical, underscore and dash are allowed.'),])
        title = models.CharField(max_length=100, null=False, blank=False)
-       author = models.ForeignKey(ConferenceRegistration, null=False, blank=False)
+       author = models.ForeignKey(ConferenceRegistration, null=False, blank=False, on_delete=models.CASCADE)
        publishedat = models.DateTimeField(null=False, blank=False, auto_now=True)
        contents = models.TextField(null=False, blank=False)
 
@@ -71,8 +71,8 @@ class Wikipage(models.Model, DiffableModel):
 # When a page is edited, the old version is copied over to the history. A page that has
 # never been edited has no history entry. Permission changes are not tracked.
 class WikipageHistory(models.Model):
-       page = models.ForeignKey(Wikipage, null=False, blank=False, db_index=True)
-       author = models.ForeignKey(ConferenceRegistration, null=False, blank=False)
+       page = models.ForeignKey(Wikipage, null=False, blank=False, db_index=True, on_delete=models.CASCADE)
+       author = models.ForeignKey(ConferenceRegistration, null=False, blank=False, on_delete=models.CASCADE)
        publishedat = models.DateTimeField(null=False, blank=False)
        contents = models.TextField(null=False, blank=False)
 
@@ -86,8 +86,8 @@ class WikipageHistory(models.Model):
 
 # Subscribers to changes of wikipages
 class WikipageSubscriber(models.Model):
-       page = models.ForeignKey(Wikipage, null=False, blank=False, db_index=True)
-       subscriber = models.ForeignKey(ConferenceRegistration, null=False, blank=False)
+       page = models.ForeignKey(Wikipage, null=False, blank=False, db_index=True, on_delete=models.CASCADE)
+       subscriber = models.ForeignKey(ConferenceRegistration, null=False, blank=False, on_delete=models.CASCADE)
 
 
 def validate_options(value):
@@ -113,8 +113,8 @@ def validate_optionvalues(value):
 
 # Signups - attendees can sign up for events
 class Signup(models.Model):
-       conference = models.ForeignKey(Conference, null=False, blank=False)
-       author = models.ForeignKey(ConferenceRegistration, null=False, blank=False)
+       conference = models.ForeignKey(Conference, null=False, blank=False, on_delete=models.CASCADE)
+       author = models.ForeignKey(ConferenceRegistration, null=False, blank=False, on_delete=models.CASCADE)
        title = models.CharField(max_length=100, null=False, blank=False)
        intro = models.TextField(null=False, blank=False)
        deadline = models.DateTimeField(null=True, blank=True)
@@ -144,8 +144,8 @@ class Signup(models.Model):
                                raise ValidationError({"optionvalues": "Cannot specify optionvalues if options are not specified!"})
 
 class AttendeeSignup(models.Model):
-       signup = models.ForeignKey(Signup, null=False, blank=False)
-       attendee = models.ForeignKey(ConferenceRegistration, null=False, blank=False)
+       signup = models.ForeignKey(Signup, null=False, blank=False, on_delete=models.CASCADE)
+       attendee = models.ForeignKey(ConferenceRegistration, null=False, blank=False, on_delete=models.CASCADE)
        choice = models.CharField(max_length=100, null=False, blank=True)
        saved = models.DateTimeField(null=False, blank=False, auto_now=True)
 
index 2906ccd6f575877d1413e739747f29befd6f1aa7..927c92a5d8de65fb3297dd933ebc9ff4bd349a23 100644 (file)
@@ -14,7 +14,7 @@ class Migration(migrations.Migration):
         migrations.CreateModel(
             name='EuropeCountry',
             fields=[
-                ('iso', models.OneToOneField(primary_key=True, serialize=False, to='countries.Country')),
+                ('iso', models.OneToOneField(primary_key=True, serialize=False, to='countries.Country', on_delete=models.CASCADE)),
             ],
         ),
     ]
index a4bc49777ec6353383d7ffb9a2ef7092fc9afc66..8d6a6811bc844a4a7a47c699d076d65a5d9a551b 100644 (file)
@@ -67,7 +67,7 @@ class UsState(models.Model):
 \r
 # XXX: this table is added by pgeu :)\r
 class EuropeCountry(models.Model):\r
-       iso = models.OneToOneField(Country, null=False, blank=False, primary_key=True)\r
+       iso = models.OneToOneField(Country, null=False, blank=False, primary_key=True, on_delete=models.CASCADE)\r
 \r
        def __unicode__(self):\r
                return iso.name\r
index 15decd5c8d5cdeb68d345b0236681cbf53fe7f6b..736c3bb0efe79173511fed3a9e61ce42650fc597 100644 (file)
@@ -36,8 +36,8 @@ class Migration(migrations.Migration):
             fields=[
                 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                 ('score', models.IntegerField()),
-                ('candidate', models.ForeignKey(to='elections.Candidate')),
-                ('election', models.ForeignKey(to='elections.Election')),
+                ('candidate', models.ForeignKey(to='elections.Candidate', on_delete=models.CASCADE)),
+                ('election', models.ForeignKey(to='elections.Election', on_delete=models.CASCADE)),
             ],
         ),
     ]
index 075e44a75c99b5dfef0a4cc822046f1032f7855e..ba5542ff31583a50d3da280b04e07b3a6ee29353 100644 (file)
@@ -15,11 +15,11 @@ class Migration(migrations.Migration):
         migrations.AddField(
             model_name='vote',
             name='voter',
-            field=models.ForeignKey(to='membership.Member'),
+            field=models.ForeignKey(to='membership.Member', on_delete=models.CASCADE),
         ),
         migrations.AddField(
             model_name='candidate',
             name='election',
-            field=models.ForeignKey(to='elections.Election'),
+            field=models.ForeignKey(to='elections.Election', on_delete=models.CASCADE),
         ),
     ]
index 20a8b8a3766153c9a4bbe3f4b01354093a977064..818290eaffeb7afc763d279814022346e6fa9eb0 100644 (file)
@@ -13,7 +13,7 @@ class Election(models.Model):
                return self.name
 
 class Candidate(models.Model):
-       election = models.ForeignKey(Election, null=False, blank=False)
+       election = models.ForeignKey(Election, null=False, blank=False, on_delete=models.CASCADE)
        name = models.CharField(max_length=100, null=False, blank=False)
        email = models.EmailField(max_length=200, null=False, blank=False)
        presentation = models.TextField(null=False, blank=False)
@@ -22,7 +22,7 @@ class Candidate(models.Model):
                return "%s (%s)" % (self.name, self.election)
 
 class Vote(models.Model):
-       election = models.ForeignKey(Election, null=False, blank=False)
-       voter = models.ForeignKey(Member, null=False, blank=False)
-       candidate = models.ForeignKey(Candidate, null=False, blank=False)
+       election = models.ForeignKey(Election, null=False, blank=False, on_delete=models.CASCADE)
+       voter = models.ForeignKey(Member, null=False, blank=False, on_delete=models.CASCADE)
+       candidate = models.ForeignKey(Candidate, null=False, blank=False, on_delete=models.CASCADE)
        score = models.IntegerField(null=False, blank=False)
index 4a80bac779d37fe34d26db6392810f13e3b0b05b..a0a2c95fe139dbefdd96e05cb8aac8bd96a6d484 100644 (file)
@@ -50,7 +50,7 @@ class Migration(migrations.Migration):
                 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                 ('time', models.DateTimeField(auto_now_add=True)),
                 ('txt', models.CharField(max_length=100)),
-                ('invoice', models.ForeignKey(to='invoices.Invoice')),
+                ('invoice', models.ForeignKey(to='invoices.Invoice', on_delete=models.CASCADE)),
             ],
             options={
                 'ordering': ['time'],
@@ -98,7 +98,7 @@ class Migration(migrations.Migration):
                 ('rowtext', models.CharField(max_length=100, verbose_name=b'Text')),
                 ('rowcount', models.IntegerField(default=1, verbose_name=b'Count')),
                 ('rowamount', models.IntegerField(default=0, verbose_name=b'Amount per item')),
-                ('invoice', models.ForeignKey(to='invoices.Invoice')),
+                ('invoice', models.ForeignKey(to='invoices.Invoice', on_delete=models.CASCADE)),
             ],
         ),
         migrations.AddField(
@@ -109,11 +109,11 @@ class Migration(migrations.Migration):
         migrations.AddField(
             model_name='invoice',
             name='processor',
-            field=models.ForeignKey(blank=True, to='invoices.InvoiceProcessor', null=True),
+            field=models.ForeignKey(blank=True, to='invoices.InvoiceProcessor', null=True, on_delete=models.CASCADE),
         ),
         migrations.AddField(
             model_name='invoice',
             name='recipient_user',
-            field=models.ForeignKey(blank=True, to=settings.AUTH_USER_MODEL, null=True),
+            field=models.ForeignKey(blank=True, to=settings.AUTH_USER_MODEL, null=True, on_delete=models.CASCADE),
         ),
     ]
index 42a2505fdbb7458bf3c78ede66562a66f06a237d..cf0a9bd22cc668e8596595af9eab755d0dbe250c 100644 (file)
@@ -17,7 +17,7 @@ class Migration(migrations.Migration):
         migrations.AddField(
             model_name='invoice',
             name='paidusing',
-            field=models.ForeignKey(related_name='paidusing', verbose_name=b'Payment method actually used', to='invoices.InvoicePaymentMethod', null=True),
+            field=models.ForeignKey(related_name='paidusing', verbose_name=b'Payment method actually used', to='invoices.InvoicePaymentMethod', null=True, on_delete=models.CASCADE),
         ),
                migrations.RunSQL("UPDATE invoices_invoice SET paidusing_id=(SELECT id FROM invoices_invoicepaymentmethod WHERE classname='postgresqleu.util.payment.adyen.AdyenCreditcard') WHERE EXISTS (SELECT 1 FROM adyen_transactionstatus WHERE notes='PGEU' || invoices_invoice.id AND method != 'bankTransfer_IBAN')"),
                migrations.RunSQL("UPDATE invoices_invoice SET paidusing_id=(SELECT id FROM invoices_invoicepaymentmethod WHERE classname='postgresqleu.util.payment.adyen.AdyenBanktransfer') WHERE EXISTS (SELECT 1 FROM adyen_transactionstatus WHERE notes='PGEU' || invoices_invoice.id AND method = 'bankTransfer_IBAN')"),
index 9534163437c1026c2f85d9f93dd8f62a79004a48..8eabc1316c45e18ac0f6bc21290cf3fbbad37d18 100644 (file)
@@ -43,6 +43,6 @@ class Migration(migrations.Migration):
         migrations.AlterField(
             model_name='invoice',
             name='paidusing',
-            field=models.ForeignKey(related_name='paidusing', verbose_name=b'Payment method actually used', blank=True, to='invoices.InvoicePaymentMethod', null=True),
+            field=models.ForeignKey(related_name='paidusing', verbose_name=b'Payment method actually used', blank=True, to='invoices.InvoicePaymentMethod', null=True, on_delete=models.CASCADE),
         ),
     ]
index f98895139416ec2b3414b2275ab7e908e0a72b2a..7227e2bb5e117cbf9987e4d51cfa8f423bace0b5 100644 (file)
@@ -20,7 +20,7 @@ class Migration(migrations.Migration):
                 ('name', models.CharField(max_length=100)),
                 ('shortname', models.CharField(max_length=16)),
                 ('vatpercent', models.IntegerField(default=0, verbose_name=b'VAT percentage', validators=[django.core.validators.MaxValueValidator(100), django.core.validators.MinValueValidator(0)])),
-                ('vataccount', models.ForeignKey(to='accounting.Account')),
+                ('vataccount', models.ForeignKey(to='accounting.Account', on_delete=models.CASCADE)),
             ],
         ),
         migrations.AddField(
@@ -41,6 +41,6 @@ class Migration(migrations.Migration):
         migrations.AddField(
             model_name='invoicerow',
             name='vatrate',
-            field=models.ForeignKey(to='invoices.VatRate', null=True),
+            field=models.ForeignKey(to='invoices.VatRate', null=True, on_delete=models.CASCADE),
         ),
     ]
index d3e0368ac436335726f3faf5c7d6823c8d0966c0..373c3cbe1dc5da0b2c46b4dc7fee30f7ac6556e7 100644 (file)
@@ -20,7 +20,7 @@ class Migration(migrations.Migration):
         migrations.AddField(
             model_name='invoicerefund',
             name='vatrate',
-            field=models.ForeignKey(to='invoices.VatRate', null=True),
+            field=models.ForeignKey(to='invoices.VatRate', null=True, on_delete=models.CASCADE),
         ),
         migrations.AlterField(
             model_name='invoicerefund',
index 0a96d67b4e4614c4b280bb461a93addf5d10baf5..1b8002da96517c70526be862fe5061f4c4cedfa7 100644 (file)
@@ -41,7 +41,7 @@ class InvoiceRefund(models.Model):
 
        amount = models.DecimalField(max_digits=10, decimal_places=2, null=False)
        vatamount = models.DecimalField(max_digits=10, decimal_places=2, null=False)
-       vatrate = models.ForeignKey('VatRate', null=True)
+       vatrate = models.ForeignKey('VatRate', null=True, on_delete=models.CASCADE)
 
        registered = models.DateTimeField(null=False, auto_now_add=True)
        issued = models.DateTimeField(null=True, blank=True)
@@ -63,7 +63,7 @@ class Invoice(models.Model):
        # by name. If email is set, we can retro-match it up, but once
        # a recipient is matched, the recipient_user field "owns" the
        # recipient information.
-       recipient_user = models.ForeignKey(User, null=True, blank=True)
+       recipient_user = models.ForeignKey(User, null=True, blank=True, on_delete=models.CASCADE)
        recipient_email = models.EmailField(blank=True, null=False)
        recipient_name = models.CharField(max_length=100, blank=False, null=False)
        recipient_address = models.TextField(blank=False, null=False)
@@ -93,7 +93,7 @@ class Invoice(models.Model):
        # of this invoice. This can typically be to flag a conference
        # payment as done once the payment is in. processorid is an arbitrary
        # id value that the processor can use for whatever it wants.
-       processor = models.ForeignKey(InvoiceProcessor, null=True, blank=True)
+       processor = models.ForeignKey(InvoiceProcessor, null=True, blank=True, on_delete=models.CASCADE)
        processorid = models.IntegerField(null=True, blank=True)
 
        # Allowed payment methods
@@ -104,7 +104,7 @@ class Invoice(models.Model):
        # writes the details of the transaction to the paymentdetails field.
        paidat = models.DateTimeField(null=True, blank=True)
        paymentdetails = models.CharField(max_length=100, null=False, blank=True)
-       paidusing = models.ForeignKey(InvoicePaymentMethod, null=True, blank=True, related_name="paidusing", verbose_name="Payment method actually used")
+       paidusing = models.ForeignKey(InvoicePaymentMethod, null=True, blank=True, related_name="paidusing", verbose_name="Payment method actually used", on_delete=models.CASCADE)
 
        # Reminder (if any) sent when?
        remindersent = models.DateTimeField(null=True, blank=True, verbose_name="Automatic reminder sent at")
@@ -187,7 +187,7 @@ class VatRate(models.Model):
        shortname = models.CharField(max_length=16, blank=False, null=False)
        vatpercent = models.IntegerField(null=False, default=0, verbose_name="VAT percentage",
                                                                         validators=[MaxValueValidator(100), MinValueValidator(0)])
-       vataccount = models.ForeignKey(Account, null=False, blank=False)
+       vataccount = models.ForeignKey(Account, null=False, blank=False, on_delete=models.CASCADE)
 
        _safe_attributes = ('vatpercent', 'shortstr', 'shortname', 'name', 'org_name', 'treasurer_email')
 
@@ -201,11 +201,11 @@ class VatRate(models.Model):
 class InvoiceRow(models.Model):
        # Invoice rows are only used up until the invoice is finished,
        # but allows us to save a half-finished invoice.
-       invoice = models.ForeignKey(Invoice, null=False)
+       invoice = models.ForeignKey(Invoice, null=False, on_delete=models.CASCADE)
        rowtext = models.CharField(max_length=100, blank=False, null=False, verbose_name="Text")
        rowcount = models.IntegerField(null=False, default=1, verbose_name="Count")
        rowamount = models.DecimalField(decimal_places=2, max_digits=10, null=False, default=0, verbose_name="Amount per item (ex VAT)")
-       vatrate = models.ForeignKey(VatRate, null=True)
+       vatrate = models.ForeignKey(VatRate, null=True, on_delete=models.CASCADE)
 
        def __unicode__(self):
                return self.rowtext
@@ -226,7 +226,7 @@ class InvoiceRow(models.Model):
                return self.totalrow + self.totalvat
 
 class InvoiceHistory(models.Model):
-       invoice = models.ForeignKey(Invoice, null=False)
+       invoice = models.ForeignKey(Invoice, null=False, on_delete=models.CASCADE)
        time = models.DateTimeField(null=False, blank=False, auto_now_add=True)
        txt = models.CharField(max_length=100, null=False, blank=False)
 
index aa51e8dd9857c24b4ec5d98bc94c38790b9ac67d..86e546b0a99cf214aea0089663635f3c1bc82f25 100644 (file)
@@ -27,14 +27,14 @@ class Migration(migrations.Migration):
         migrations.CreateModel(
             name='Member',
             fields=[
-                ('user', models.OneToOneField(primary_key=True, serialize=False, to=settings.AUTH_USER_MODEL)),
+                ('user', models.OneToOneField(primary_key=True, serialize=False, to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE)),
                 ('fullname', models.CharField(max_length=500, verbose_name=b'Full name')),
                 ('listed', models.BooleanField(default=True, verbose_name=b'Listed in the public membership list')),
                 ('paiduntil', models.DateField(null=True, blank=True)),
                 ('membersince', models.DateField(null=True, blank=True)),
                 ('expiry_warning_sent', models.DateTimeField(null=True, blank=True)),
-                ('activeinvoice', models.ForeignKey(blank=True, to='invoices.Invoice', null=True)),
-                ('country', models.ForeignKey(to='countries.Country')),
+                ('activeinvoice', models.ForeignKey(blank=True, to='invoices.Invoice', null=True, on_delete=models.CASCADE)),
+                ('country', models.ForeignKey(to='countries.Country', on_delete=models.CASCADE)),
             ],
         ),
         migrations.CreateModel(
@@ -43,7 +43,7 @@ class Migration(migrations.Migration):
                 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                 ('timestamp', models.DateTimeField()),
                 ('message', models.TextField()),
-                ('member', models.ForeignKey(to='membership.Member')),
+                ('member', models.ForeignKey(to='membership.Member', on_delete=models.CASCADE)),
             ],
         ),
         migrations.CreateModel(
@@ -51,8 +51,8 @@ class Migration(migrations.Migration):
             fields=[
                 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                 ('key', models.CharField(max_length=100)),
-                ('meeting', models.ForeignKey(to='membership.Meeting')),
-                ('member', models.ForeignKey(to='membership.Member')),
+                ('meeting', models.ForeignKey(to='membership.Meeting', on_delete=models.CASCADE)),
+                ('member', models.ForeignKey(to='membership.Member', on_delete=models.CASCADE)),
             ],
         ),
         migrations.AddField(
index 66e7eeb83549823617b17caf2e2ca66def0c8a3f..e9d330211caa17341fcfc19a166b212390ebde77 100644 (file)
@@ -7,10 +7,10 @@ from postgresqleu.invoices.models import Invoice
 from datetime import date, datetime, timedelta
 
 class Member(models.Model):
-       user = models.OneToOneField(User, null=False, blank=False, primary_key=True)
+       user = models.OneToOneField(User, null=False, blank=False, primary_key=True, on_delete=models.CASCADE)
        fullname = models.CharField(max_length=500, null=False, blank=False,
                                                                verbose_name='Full name')
-       country = models.ForeignKey(Country, null=False, blank=False)
+       country = models.ForeignKey(Country, null=False, blank=False, on_delete=models.CASCADE)
        listed = models.BooleanField(null=False, blank=False, default=True,
                                                                 verbose_name='Listed in the public membership list')
        paiduntil = models.DateField(null=True, blank=True)
@@ -18,7 +18,7 @@ class Member(models.Model):
 
        # If there is a currently active invoice, link to it here so we can
        # easily render the information on the page.
-       activeinvoice = models.ForeignKey(Invoice, null=True, blank=True)
+       activeinvoice = models.ForeignKey(Invoice, null=True, blank=True, on_delete=models.CASCADE)
 
        # When a membeship expiry warning was last sent, so we don't keep
        # sending them over and over again
@@ -43,7 +43,7 @@ class Member(models.Model):
                return "%s (%s)" % (self.fullname, self.user.username)
 
 class MemberLog(models.Model):
-       member = models.ForeignKey(Member, null=False, blank=False)
+       member = models.ForeignKey(Member, null=False, blank=False, on_delete=models.CASCADE)
        timestamp = models.DateTimeField(null=False)
        message = models.TextField(null=False, blank=False)
 
@@ -74,8 +74,8 @@ class Meeting(models.Model):
 
 
 class MemberMeetingKey(models.Model):
-       member = models.ForeignKey(Member, null=False, blank=False)
-       meeting = models.ForeignKey(Meeting, null=False, blank=False)
+       member = models.ForeignKey(Member, null=False, blank=False, on_delete=models.CASCADE)
+       meeting = models.ForeignKey(Meeting, null=False, blank=False, on_delete=models.CASCADE)
        key = models.CharField(max_length=100, null=False, blank=False)
        proxyname = models.CharField(max_length=200, null=True, blank=False)
        proxyaccesskey = models.CharField(max_length=100, null=True, blank=False)
index d15f2428f0c9688df5cc33dbb8b79b8be3cf8784..b8173a3f43ac376152d543c291418080a136bc19 100644 (file)
@@ -21,7 +21,7 @@ class Migration(migrations.Migration):
                 ('city', models.CharField(max_length=128)),
                 ('state', models.CharField(max_length=8, blank=True)),
                 ('summary', models.TextField()),
-                ('country', models.ForeignKey(to='countries.Country')),
+                ('country', models.ForeignKey(to='countries.Country', on_delete=models.CASCADE)),
             ],
             options={
                 'ordering': ['startdate', 'title'],
index cdd8e4695d258345dfca16f0cf530180bf639533..4dc61a584b5ec22ea94f37c1d40fb29099f06552 100644 (file)
@@ -41,7 +41,7 @@ class Migration(migrations.Migration):
                 ('transtext', models.CharField(max_length=1000)),
                 ('matched', models.BooleanField()),
                 ('matchinfo', models.CharField(max_length=1000, null=True, blank=True)),
-                ('sourceaccount', models.ForeignKey(to='paypal.SourceAccount')),
+                ('sourceaccount', models.ForeignKey(to='paypal.SourceAccount', on_delete=models.CASCADE)),
             ],
         ),
     ]
index ffc4f3692037c21209960afd885cd1acac0ced15..d98568a3d77d9b93b67f9b4affa41c937ab45e8a 100644 (file)
@@ -12,7 +12,7 @@ class SourceAccount(models.Model):
 class TransactionInfo(models.Model):
        paypaltransid = models.CharField(max_length=20, null=False, blank=False, unique=True)
        timestamp = models.DateTimeField(null=False, blank=False)
-       sourceaccount = models.ForeignKey(SourceAccount, null=False, blank=False)
+       sourceaccount = models.ForeignKey(SourceAccount, null=False, blank=False, on_delete=models.CASCADE)
        sender = models.CharField(max_length=200, null=False, blank=False)
        sendername = models.CharField(max_length=200, null=False, blank=False)
        amount = models.DecimalField(decimal_places=2, max_digits=10, null=False, blank=False)
index 3b8bd8fc89564a45ff8144a900b9acebb05bf507..6b01a9835cdd2e977057e90128b01d2f64637bf1 100644 (file)
@@ -65,6 +65,6 @@ class Migration(migrations.Migration):
         migrations.AddField(
             model_name='trustlynotification',
             name='rawnotification',
-            field=models.ForeignKey(blank=True, to='trustlypayment.TrustlyRawNotification', null=True),
+            field=models.ForeignKey(blank=True, to='trustlypayment.TrustlyRawNotification', null=True, on_delete=models.CASCADE),
         ),
     ]
index 13dc54c229a4601fb27998c578d8b65a3b2de8de..2de9061fa617aaf51dd0a7ea02d792f3c94075f0 100644 (file)
@@ -22,7 +22,7 @@ class TrustlyRawNotification(models.Model):
 
 class TrustlyNotification(models.Model):
        receivedat = models.DateTimeField(null=False, blank=False, auto_now_add=True, unique=True)
-       rawnotification = models.ForeignKey(TrustlyRawNotification, null=True, blank=True)
+       rawnotification = models.ForeignKey(TrustlyRawNotification, null=True, blank=True, on_delete=models.CASCADE)
        notificationid = models.BigIntegerField(null=False, blank=False)
        orderid = models.BigIntegerField(null=False, blank=False)
        method = models.CharField(max_length=80, null=False, blank=False)