From 7325dace93d30829fa3efbcba1371b7c39da56d7 Mon Sep 17 00:00:00 2001 From: Ross Date: Thu, 23 Dec 2021 17:30:08 +0000 Subject: [PATCH] . --- .../0024_alter_case_previous_case.py | 19 +++++++++++++++++++ .../0023_alter_examination_examination.py | 18 ++++++++++++++++++ generic/models.py | 2 +- generic/views.py | 2 +- 4 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 atlas/migrations/0024_alter_case_previous_case.py create mode 100644 generic/migrations/0023_alter_examination_examination.py diff --git a/atlas/migrations/0024_alter_case_previous_case.py b/atlas/migrations/0024_alter_case_previous_case.py new file mode 100644 index 00000000..3d4d0a13 --- /dev/null +++ b/atlas/migrations/0024_alter_case_previous_case.py @@ -0,0 +1,19 @@ +# Generated by Django 3.2.10 on 2021-12-23 17:28 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('atlas', '0023_case_previous_case'), + ] + + operations = [ + migrations.AlterField( + model_name='case', + name='previous_case', + field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='next_case', to='atlas.case'), + ), + ] diff --git a/generic/migrations/0023_alter_examination_examination.py b/generic/migrations/0023_alter_examination_examination.py new file mode 100644 index 00000000..eecd344c --- /dev/null +++ b/generic/migrations/0023_alter_examination_examination.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2.10 on 2021-12-23 17:28 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('generic', '0022_ciduser_results_email_sent'), + ] + + operations = [ + migrations.AlterField( + model_name='examination', + name='examination', + field=models.CharField(max_length=200, unique=True), + ), + ] diff --git a/generic/models.py b/generic/models.py index 03912fbf..f6dac691 100644 --- a/generic/models.py +++ b/generic/models.py @@ -41,7 +41,7 @@ class Contrast(models.Model): class Examination(models.Model): - examination = models.CharField(max_length=200) + examination = models.CharField(max_length=200, unique=True) def __str__(self): return self.examination diff --git a/generic/views.py b/generic/views.py index 101501bd..2f61c54a 100644 --- a/generic/views.py +++ b/generic/views.py @@ -1253,7 +1253,7 @@ class ExaminationAutocomplete(autocomplete.Select2QuerySetView): if self.q: # This raises a fielderror which breaks creating a new item if not caught try: - qs = qs.filter(name__icontains=self.q) + qs = qs.filter(examination__icontains=self.q) except FieldError: return Examination.objects.none()