From 40cd816b4e1deca16ff0eaf78fe62d9af53f5c46 Mon Sep 17 00:00:00 2001 From: Matt Cottingham Date: Thu, 24 Oct 2019 14:49:13 +0100 Subject: [PATCH 1/3] Make comms channel -- incident relation OneToOne --- response/slack/models/comms_channel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/response/slack/models/comms_channel.py b/response/slack/models/comms_channel.py index 64aa57e4..0897303c 100644 --- a/response/slack/models/comms_channel.py +++ b/response/slack/models/comms_channel.py @@ -59,7 +59,7 @@ def create_comms_channel(self, incident): class CommsChannel(models.Model): objects = CommsChannelManager() - incident = models.ForeignKey(Incident, on_delete=models.CASCADE) + incident = models.OneToOneField(Incident, on_delete=models.CASCADE) channel_id = models.CharField(max_length=20, null=False) channel_name = models.CharField(max_length=80, null=False) From b644432c0a22ec13b9ae5408e0f3ecd01af251cb Mon Sep 17 00:00:00 2001 From: Matt Cottingham Date: Thu, 24 Oct 2019 16:13:51 +0100 Subject: [PATCH 2/3] Migration: make CommsChannel-Incident relation OneToOne --- .../migrations/0012_commschannel_onetoone.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 response/migrations/0012_commschannel_onetoone.py diff --git a/response/migrations/0012_commschannel_onetoone.py b/response/migrations/0012_commschannel_onetoone.py new file mode 100644 index 00000000..68927f7f --- /dev/null +++ b/response/migrations/0012_commschannel_onetoone.py @@ -0,0 +1,19 @@ +# Generated by Django 2.2.3 on 2019-10-24 14:55 + +import django.db.models.deletion +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [("response", "0011_auto_20190927_1339")] + + operations = [ + migrations.AlterField( + model_name="commschannel", + name="incident", + field=models.OneToOneField( + on_delete=django.db.models.deletion.CASCADE, to="response.Incident" + ), + ) + ] From b0291f47dfcaa84a9ae5e35d3ae070fee4612312 Mon Sep 17 00:00:00 2001 From: Matt Cottingham Date: Thu, 24 Oct 2019 17:40:52 +0100 Subject: [PATCH 3/3] Bump version to 0.1.20 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 95d5ccfb..40af517f 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ from setuptools import find_packages, setup -VERSION = "0.1.19" +VERSION = "0.1.20" INSTALL_REQUIRES = [ "Django>=2.2",