From 6510761033087ebb28254ee61509cf0583d2dbe1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niccol=C3=B2=20Cant=C3=B9?= Date: Wed, 4 Dec 2024 10:41:50 +0100 Subject: [PATCH] allow to occupy plate positions, without samples --- ...011_extractplateposition_notes_and_more.py | 29 +++++++++++++++++++ src/genlab_bestilling/models.py | 7 ++++- 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 src/genlab_bestilling/migrations/0011_extractplateposition_notes_and_more.py diff --git a/src/genlab_bestilling/migrations/0011_extractplateposition_notes_and_more.py b/src/genlab_bestilling/migrations/0011_extractplateposition_notes_and_more.py new file mode 100644 index 0000000..2f608e7 --- /dev/null +++ b/src/genlab_bestilling/migrations/0011_extractplateposition_notes_and_more.py @@ -0,0 +1,29 @@ +# Generated by Django 5.1.3 on 2024-12-04 09:42 + +import django.db.models.deletion +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("genlab_bestilling", "0010_remove_extractionplate_extracted_at_and_more"), + ] + + operations = [ + migrations.AddField( + model_name="extractplateposition", + name="notes", + field=models.CharField(blank=True, null=True), + ), + migrations.AlterField( + model_name="extractplateposition", + name="sample", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name="plate_positions", + to="genlab_bestilling.sample", + ), + ), + ] diff --git a/src/genlab_bestilling/models.py b/src/genlab_bestilling/models.py index 85085f6..e7443a6 100644 --- a/src/genlab_bestilling/models.py +++ b/src/genlab_bestilling/models.py @@ -360,10 +360,15 @@ class ExtractPlatePosition(models.Model): "ExtractionPlate", on_delete=models.DO_NOTHING, related_name="sample_positions" ) sample = models.ForeignKey( - "Sample", on_delete=models.PROTECT, related_name="plate_positions" + "Sample", + on_delete=models.PROTECT, + related_name="plate_positions", + null=True, + blank=True, ) position = models.IntegerField() extracted_at = models.DateTimeField(auto_now=True) + notes = models.CharField(null=True, blank=True) # TODO: unique position per plate class Meta: