diff --git a/atlas/forms.py b/atlas/forms.py index 14c11a58..d18d1161 100755 --- a/atlas/forms.py +++ b/atlas/forms.py @@ -24,6 +24,7 @@ from atlas.models import ( Case, CaseCollection, CaseDetail, + CasePrior, CidReportAnswer, Differential, Finding, @@ -858,10 +859,19 @@ class QuestionSchemaForm(ModelForm): "schema": SvelteJSONEditorWidgetOverride(), } +#class ModelPriorCaseForm(ModelForm): +# class Meta: +# model = CasePrior +# fields = ["case_detail", "prior_case", "relation_text", "prior_visibility"] + class PriorCaseForm(Form): relation = CharField(max_length=255, required=True) + prior_visibility = CharField(max_length=2, required=True) + + + #def __init__(self, *args, **kwargs): # self.case_detail = kwargs.pop( # "case_detail" diff --git a/atlas/migrations/0069_caseprior_prior_visibility.py b/atlas/migrations/0069_caseprior_prior_visibility.py new file mode 100644 index 00000000..cbb01e4b --- /dev/null +++ b/atlas/migrations/0069_caseprior_prior_visibility.py @@ -0,0 +1,18 @@ +# Generated by Django 5.1.4 on 2025-04-28 15:04 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('atlas', '0068_alter_seriesfinding_description'), + ] + + operations = [ + migrations.AddField( + model_name='caseprior', + name='prior_visibility', + field=models.CharField(choices=[('NO', 'None'), ('AL', 'Always'), ('RE', 'Review')], default='AL', help_text='Defines when the prior case is shown to the user', max_length=2), + ), + ] diff --git a/atlas/models.py b/atlas/models.py index 99b9b8bd..d5b354ef 100644 --- a/atlas/models.py +++ b/atlas/models.py @@ -1118,6 +1118,19 @@ class CasePrior(models.Model): relation_text = models.CharField(max_length=255, blank=True, help_text="Text to describe the relationship between the cases") + class PriorVisibility(models.TextChoices): + NONE = "NO", _("None") + ALWAYS = "AL", _("Always") + REVIEW = "RE", _("Review") + + + prior_visibility = models.CharField( + max_length=2, + choices=PriorVisibility.choices, + default=PriorVisibility.ALWAYS, + help_text="Defines when the prior case is shown to the user", + ) + class Meta: unique_together = ("case_detail", "prior_case") diff --git a/atlas/templates/atlas/case_display_block.html b/atlas/templates/atlas/case_display_block.html index 0077c8c8..44583711 100755 --- a/atlas/templates/atlas/case_display_block.html +++ b/atlas/templates/atlas/case_display_block.html @@ -253,7 +253,7 @@ + Add to collection {% endif %}