diff --git a/peachjam/migrations/0125_judgment_auto_assign_title.py b/peachjam/migrations/0125_judgment_auto_assign_title.py new file mode 100644 index 000000000..b95b9b1c8 --- /dev/null +++ b/peachjam/migrations/0125_judgment_auto_assign_title.py @@ -0,0 +1,22 @@ +# Generated by Django 3.2.24 on 2024-04-10 07:59 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("peachjam", "0124_peachjamsettings_contact_form_url"), + ] + + operations = [ + migrations.AddField( + model_name="judgment", + name="auto_assign_title", + field=models.BooleanField( + default=True, + help_text="Whether or not the system should assign the title", + verbose_name="Auto-assign title", + ), + ), + ] diff --git a/peachjam/models/judgment.py b/peachjam/models/judgment.py index fe93c3dec..de192140e 100644 --- a/peachjam/models/judgment.py +++ b/peachjam/models/judgment.py @@ -261,6 +261,12 @@ class Judgment(CoreDocument): ) hearing_date = models.DateField(null=True, blank=True) + auto_assign_title = models.BooleanField( + _("Auto-assign title"), + help_text=_("Whether or not the system should assign the title"), + default=True, + ) + CITATION_DATE_FORMAT = "(j F Y)" MNC_FORMAT = "[{year}] {author} {serial}" @@ -384,7 +390,8 @@ def pre_save(self): self.doc_type = "judgment" self.assign_mnc() - self.assign_title() + if self.auto_assign_title: + self.assign_title() super().pre_save()