From 5c668bd8881ac01cb3ca28e09209c77aafaccdab Mon Sep 17 00:00:00 2001 From: Struan Donald Date: Wed, 10 Apr 2024 17:09:57 +0100 Subject: [PATCH] make marking session links mandatory everything should be part of marking session --- .../0041_make_marking_session_mandatory.py | 38 +++++++++++++++++++ crowdsourcer/models.py | 12 ++---- 2 files changed, 41 insertions(+), 9 deletions(-) create mode 100644 crowdsourcer/migrations/0041_make_marking_session_mandatory.py diff --git a/crowdsourcer/migrations/0041_make_marking_session_mandatory.py b/crowdsourcer/migrations/0041_make_marking_session_mandatory.py new file mode 100644 index 00000000..b5353b92 --- /dev/null +++ b/crowdsourcer/migrations/0041_make_marking_session_mandatory.py @@ -0,0 +1,38 @@ +# Generated by Django 4.2.5 on 2024-04-10 15:57 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ("crowdsourcer", "0040_link_to_initial_marking_session"), + ] + + operations = [ + migrations.AlterField( + model_name="assigned", + name="marking_session", + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + to="crowdsourcer.markingsession", + ), + ), + migrations.AlterField( + model_name="responsetype", + name="marking_session", + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + to="crowdsourcer.markingsession", + ), + ), + migrations.AlterField( + model_name="section", + name="marking_session", + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + to="crowdsourcer.markingsession", + ), + ), + ] diff --git a/crowdsourcer/models.py b/crowdsourcer/models.py index 9c6fe101..9fc09955 100644 --- a/crowdsourcer/models.py +++ b/crowdsourcer/models.py @@ -23,9 +23,7 @@ class Section(models.Model): """Used to group questions with a similar theme""" title = models.CharField(max_length=200) - marking_session = models.ForeignKey( - MarkingSession, on_delete=models.CASCADE, null=True - ) + marking_session = models.ForeignKey(MarkingSession, on_delete=models.CASCADE) def __str__(self): return self.title @@ -209,9 +207,7 @@ class ResponseType(models.Model): type = models.TextField(max_length=200) priority = models.IntegerField() active = models.BooleanField(default=False) - marking_session = models.ForeignKey( - MarkingSession, on_delete=models.CASCADE, null=True - ) + marking_session = models.ForeignKey(MarkingSession, on_delete=models.CASCADE) def __str__(self): return self.type @@ -305,9 +301,7 @@ class Assigned(models.Model): response_type = models.ForeignKey( ResponseType, on_delete=models.CASCADE, null=True, blank=True ) - marking_session = models.ForeignKey( - MarkingSession, on_delete=models.CASCADE, null=True - ) + marking_session = models.ForeignKey(MarkingSession, on_delete=models.CASCADE) history = HistoricalRecords() @classmethod