From: Radek Czajka Date: Wed, 9 Jun 2021 09:59:24 +0000 (+0200) Subject: Set null on user delete. X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/689dab7f9aab019f0419133043bf02efcf469c93?ds=sidebyside;hp=dce4cbe605cb926b5583f7ddd325704b527e7e5c Set null on user delete. --- diff --git a/src/club/migrations/0027_auto_20210609_1158.py b/src/club/migrations/0027_auto_20210609_1158.py new file mode 100644 index 000000000..fa0edb8c3 --- /dev/null +++ b/src/club/migrations/0027_auto_20210609_1158.py @@ -0,0 +1,19 @@ +# Generated by Django 2.2.19 on 2021-06-09 09:58 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('club', '0026_schedule_source'), + ] + + operations = [ + migrations.AlterField( + model_name='schedule', + name='membership', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='club.Membership', verbose_name='membership'), + ), + ] diff --git a/src/club/models.py b/src/club/models.py index babe6f568..a8b07abc0 100644 --- a/src/club/models.py +++ b/src/club/models.py @@ -47,7 +47,7 @@ class Schedule(models.Model): """ Represents someone taking up a plan. """ key = models.CharField(_('key'), max_length=255, unique=True) email = models.EmailField(_('email')) - membership = models.ForeignKey('Membership', verbose_name=_('membership'), null=True, blank=True, on_delete=models.PROTECT) + membership = models.ForeignKey('Membership', verbose_name=_('membership'), null=True, blank=True, on_delete=models.SET_NULL) amount = models.DecimalField(_('amount'), max_digits=10, decimal_places=2) monthly = models.BooleanField(_('monthly'), default=True) yearly = models.BooleanField(_('yearly'), default=False)