diff --git a/src/apps/datasets/migrations/0007_auto_20230609_1738.py b/src/apps/datasets/migrations/0007_auto_20230609_1738.py new file mode 100644 index 000000000..f54d966c8 --- /dev/null +++ b/src/apps/datasets/migrations/0007_auto_20230609_1738.py @@ -0,0 +1,19 @@ +# Generated by Django 2.2.17 on 2023-06-09 17:38 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('datasets', '0006_auto_20230528_0829'), + ] + + operations = [ + migrations.AlterField( + model_name='data', + name='competition', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='submission', to='competitions.Competition'), + ), + ] diff --git a/src/apps/datasets/models.py b/src/apps/datasets/models.py index 3d97e8b45..48d50f3f3 100644 --- a/src/apps/datasets/models.py +++ b/src/apps/datasets/models.py @@ -58,7 +58,7 @@ class Data(ChaHubSaveMixin, models.Model): # are NOT marked True, since they are not created by unpacking! was_created_by_competition = models.BooleanField(default=False) - competition = models.ForeignKey(Competition, on_delete=models.PROTECT, null=True, related_name='submission') + competition = models.ForeignKey(Competition, on_delete=models.CASCADE, null=True, related_name='submission') file_name = models.CharField(max_length=64, default="") def get_download_url(self):