diff options
Diffstat (limited to '')
39 files changed, 224 insertions, 804 deletions
diff --git a/ctrack/assessments/migrations/0001_initial.py b/ctrack/assessments/migrations/0001_initial.py index 94afdf9..3789ad7 100644 --- a/ctrack/assessments/migrations/0001_initial.py +++ b/ctrack/assessments/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 2.2.9 on 2020-04-03 14:07 +# Generated by Django 2.2.12 on 2020-08-27 09:40 from django.db import migrations, models import django.db.models.deletion @@ -9,20 +9,46 @@ class Migration(migrations.Migration): initial = True dependencies = [ + ('organisations', '0001_initial'), + ('caf', '0001_initial'), ] operations = [ migrations.CreateModel( + name='AchievementLevel', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('descriptor', models.CharField(max_length=50)), + ('colour_description', models.CharField(max_length=100)), + ('colour_hex', models.CharField(max_length=8)), + ], + ), + migrations.CreateModel( name='CAFAssessment', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('comments', models.TextField(max_length=500)), + ('caf', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='caf.CAF')), + ('completer', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='organisations.Person')), ], options={ 'verbose_name': 'CAF Assessment', }, ), migrations.CreateModel( + name='CAFContributingOutcome', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('designation', models.CharField(help_text='e.g. A1.a, B3.c, etc', max_length=5)), + ('name', models.CharField(help_text='e.g. Board Direction', max_length=100)), + ('description', models.TextField(max_length=1000)), + ('order_id', models.IntegerField()), + ], + options={ + 'verbose_name': 'CAF Contributing Outcome', + }, + ), + migrations.CreateModel( name='CAFObjective', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), @@ -35,33 +61,36 @@ class Migration(migrations.Migration): }, ), migrations.CreateModel( - name='CAFPrinciple', + name='IGP', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('designation', models.CharField(help_text='e.g. A1, B3, etc', max_length=5)), - ('title', models.CharField(max_length=50)), - ('description', models.TextField(max_length=1000)), - ('order_id', models.IntegerField()), - ('caf_objective', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='assessments.CAFObjective')), + ('descriptive_text', models.CharField(max_length=2000)), + ('achievement_level', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='assessments.AchievementLevel')), + ('contributing_outcome', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='assessments.CAFContributingOutcome')), ], options={ - 'verbose_name': 'CAF Principle', + 'verbose_name': 'IGP', }, ), migrations.CreateModel( - name='CAFContributingOutcome', + name='CAFPrinciple', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('designation', models.CharField(help_text='e.g. A1.a, B3.c, etc', max_length=5)), - ('name', models.CharField(help_text='e.g. Board Direction', max_length=100)), + ('designation', models.CharField(help_text='e.g. A1, B3, etc', max_length=5)), + ('title', models.CharField(max_length=50)), ('description', models.TextField(max_length=1000)), ('order_id', models.IntegerField()), - ('principle', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='assessments.CAFPrinciple')), + ('caf_objective', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='assessments.CAFObjective')), ], options={ - 'verbose_name': 'CAF Contributing Outcome', + 'verbose_name': 'CAF Principle', }, ), + migrations.AddField( + model_name='cafcontributingoutcome', + name='principle', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='assessments.CAFPrinciple'), + ), migrations.CreateModel( name='CAFAssessmentOutcomeScore', fields=[ diff --git a/ctrack/assessments/migrations/0002_cafassessment_caf.py b/ctrack/assessments/migrations/0002_cafassessment_caf.py deleted file mode 100644 index db08459..0000000 --- a/ctrack/assessments/migrations/0002_cafassessment_caf.py +++ /dev/null @@ -1,22 +0,0 @@ -# Generated by Django 2.2.9 on 2020-04-03 14:07 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - initial = True - - dependencies = [ - ('assessments', '0001_initial'), - ('caf', '0001_initial'), - ] - - operations = [ - migrations.AddField( - model_name='cafassessment', - name='caf', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='caf.CAF'), - ), - ] diff --git a/ctrack/assessments/migrations/0003_cafassessment_completer.py b/ctrack/assessments/migrations/0003_cafassessment_completer.py deleted file mode 100644 index 63b3b18..0000000 --- a/ctrack/assessments/migrations/0003_cafassessment_completer.py +++ /dev/null @@ -1,22 +0,0 @@ -# Generated by Django 2.2.9 on 2020-04-03 14:07 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - initial = True - - dependencies = [ - ('organisations', '0001_initial'), - ('assessments', '0002_cafassessment_caf'), - ] - - operations = [ - migrations.AddField( - model_name='cafassessment', - name='completer', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='organisations.Person'), - ), - ] diff --git a/ctrack/assessments/migrations/0004_achievementlevel_igp.py b/ctrack/assessments/migrations/0004_achievementlevel_igp.py deleted file mode 100644 index 581a115..0000000 --- a/ctrack/assessments/migrations/0004_achievementlevel_igp.py +++ /dev/null @@ -1,32 +0,0 @@ -# Generated by Django 3.0.5 on 2020-05-12 14:00 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('assessments', '0003_cafassessment_completer'), - ] - - operations = [ - migrations.CreateModel( - name='AchievementLevel', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('descriptor', models.CharField(max_length=50)), - ('color_description', models.CharField(max_length=100)), - ('color_hex', models.CharField(max_length=8)), - ], - ), - migrations.CreateModel( - name='IGP', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('descriptive_text', models.CharField(max_length=2000)), - ('achievement_level', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='assessments.AchievementLevel')), - ('contributing_outcome', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='assessments.CAFContributingOutcome')), - ], - ), - ] diff --git a/ctrack/assessments/migrations/0005_auto_20200512_1438.py b/ctrack/assessments/migrations/0005_auto_20200512_1438.py deleted file mode 100644 index 31a741a..0000000 --- a/ctrack/assessments/migrations/0005_auto_20200512_1438.py +++ /dev/null @@ -1,27 +0,0 @@ -# Generated by Django 3.0.5 on 2020-05-12 14:38 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('assessments', '0004_achievementlevel_igp'), - ] - - operations = [ - migrations.AlterModelOptions( - name='igp', - options={'verbose_name': 'IGP'}, - ), - migrations.RenameField( - model_name='achievementlevel', - old_name='color_description', - new_name='colour_description', - ), - migrations.RenameField( - model_name='achievementlevel', - old_name='color_hex', - new_name='colour_hex', - ), - ] diff --git a/ctrack/caf/admin.py b/ctrack/caf/admin.py index f19e8f4..e633029 100644 --- a/ctrack/caf/admin.py +++ b/ctrack/caf/admin.py @@ -5,24 +5,29 @@ from .models import CAF, FileStore, DocumentFile, Grading, ApplicableSystem class ApplicableSystemListAdmin(admin.ModelAdmin): model = ApplicableSystem - list_display = ["name", "organisation", "caf"] + list_display = ["name", "function"] -class ApplicableSystemAdmin(admin.StackedInline): - model = ApplicableSystem - max_num = 3 - extra = 1 +# FIXME +# class ApplicableSystemAdmin(admin.StackedInline): +# model = ApplicableSystem +# max_num = 3 +# extra = 1 -def get_caf_name(obj): - ass = ApplicableSystem.objects.filter(caf=obj).first() - return f"{ass.organisation.name}_v{obj.version}" +# FIXME - NOT NEEDED +# def get_caf_name(obj): +# ass = ApplicableSystem.objects.filter(caf=obj).first() +# return f"{ass.organisation.name}_v{obj.version}" +# FIXME class CAFAdmin(admin.ModelAdmin): model = CAF - inlines = [ApplicableSystemAdmin] - list_display = [get_caf_name, "quality_grading", "confidence_grading", "file"] + # inlines = [ApplicableSystemAdmin] + + +# list_display = ["quality_grading", "confidence_grading", "file"] admin.site.register(CAF, CAFAdmin) diff --git a/ctrack/caf/forms.py b/ctrack/caf/forms.py index 7367ccd..928686d 100644 --- a/ctrack/caf/forms.py +++ b/ctrack/caf/forms.py @@ -15,9 +15,10 @@ from django.urls import reverse from ctrack.caf.models import CAF, ApplicableSystem from ctrack.organisations.models import Organisation -CAFCreateInlineFormset = inlineformset_factory( - CAF, ApplicableSystem, fields=("name", "organisation"), extra=2 -) +# TODO - Replace this to get inlineformet working +# CAFCreateInlineFormset = inlineformset_factory( +# CAF, ApplicableSystem, fields=("name", "organisation"), extra=2 +# ) class ApplicableSystemCreateFromCafForm(forms.Form): diff --git a/ctrack/caf/migrations/0001_initial.py b/ctrack/caf/migrations/0001_initial.py index 5e184df..ca65af6 100644 --- a/ctrack/caf/migrations/0001_initial.py +++ b/ctrack/caf/migrations/0001_initial.py @@ -1,6 +1,8 @@ -# Generated by Django 2.2.9 on 2020-04-03 14:07 +# Generated by Django 2.2.12 on 2020-08-27 09:40 +import ctrack.caf.models from django.db import migrations, models +import django.db.models.deletion class Migration(migrations.Migration): @@ -8,6 +10,7 @@ class Migration(migrations.Migration): initial = True dependencies = [ + ('organisations', '0001_initial'), ] operations = [ @@ -15,49 +18,68 @@ class Migration(migrations.Migration): name='ApplicableSystem', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=256)), - ('description', models.TextField(max_length=1000)), + ('name', models.CharField(help_text='System name assigned by OES', max_length=256)), + ('function', models.TextField(blank=True, help_text='How the system is relevant to delivering or supporting the essential service', max_length=1000, null=True)), + ('dft_categorisation', models.CharField(choices=[('CR', 'Critical'), ('IM', 'Important (Legacy use only)')], default='CR', help_text='Refer to documentation for description of these criteria', max_length=2, verbose_name='DfT Categorisation')), + ('oes_categorisation', models.CharField(default='NA', help_text="Categorisation based on OES' own internal prioritisation process.", max_length=255, verbose_name='OES Categorisation')), ], options={ - 'verbose_name': 'Applicable System', + 'verbose_name': 'NIS System', }, ), migrations.CreateModel( - name='CAF', + name='Grading', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('version', models.CharField(blank=True, max_length=10, null=True)), - ('triage_review_date', models.DateField(blank=True, null=True)), - ('comments', models.TextField(max_length=1000)), + ('descriptor', models.CharField(help_text='Q1, C1, etc', max_length=2)), + ('description', models.TextField(max_length=250)), + ('type', models.CharField(choices=[('CONFIDENCE', 'Confidence'), ('QUALITY', 'Quality'), ('MISC', 'Misc')], help_text='Type of grading', max_length=20)), ], - options={ - 'verbose_name': 'CAF', - }, ), migrations.CreateModel( - name='DocumentFile', + name='FileStore', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=255)), - ('type', models.IntegerField(choices=[(1, 'Excel'), (2, 'Word'), (3, 'PDF'), (4, 'Hard Copy')], default=1)), + ('descriptor', models.CharField(max_length=100)), + ('virtual_location', models.CharField(help_text='USB, Rosa, email, etc', max_length=100)), + ('physical_location', models.CharField(blank=True, help_text='Cupboard, room, building, etc', max_length=100)), + ('physical_location_organisation', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='organisations.Organisation')), ], ), migrations.CreateModel( - name='FileStore', + name='EssentialService', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('descriptor', models.CharField(max_length=100)), - ('virtual_location', models.CharField(help_text='USB, Rosa, email, etc', max_length=100)), - ('physical_location', models.CharField(blank=True, help_text='Cupboard, room, building, etc', max_length=100)), + ('name', models.CharField(max_length=256)), + ('description', models.CharField(max_length=512)), + ('organisation', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='organisations.Organisation')), + ('systems', models.ManyToManyField(to='caf.ApplicableSystem')), ], ), migrations.CreateModel( - name='Grading', + name='DocumentFile', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('descriptor', models.CharField(help_text='Q1, C1, etc', max_length=2)), - ('description', models.TextField(max_length=250)), - ('type', models.CharField(choices=[('CONFIDENCE', 'Confidence'), ('QUALITY', 'Quality'), ('MISC', 'Misc')], help_text='Type of grading', max_length=20)), + ('name', models.CharField(max_length=255)), + ('type', models.IntegerField(choices=[(1, 'Excel'), (2, 'Word'), (3, 'PDF'), (4, 'Hard Copy')], default=1)), + ('file_store_location', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='caf.FileStore')), ], ), + migrations.CreateModel( + name='CAF', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('version', models.CharField(blank=True, max_length=10, null=True)), + ('triage_review_date', models.DateField(blank=True, null=True)), + ('comments', models.TextField(max_length=1000)), + ('confidence_grading', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='confidence_grading', to='caf.Grading')), + ('file', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='caf.DocumentFile')), + ('organisation', models.ForeignKey(on_delete=models.SET(ctrack.caf.models.CAF.get_sentinel_org), to='organisations.Organisation')), + ('quality_grading', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='quality_grading', to='caf.Grading')), + ('triage_review_inspector', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='organisations.Person')), + ], + options={ + 'verbose_name': 'CAF', + }, + ), ] diff --git a/ctrack/caf/migrations/0002_auto_20200403_1407.py b/ctrack/caf/migrations/0002_auto_20200403_1407.py deleted file mode 100644 index e5963d5..0000000 --- a/ctrack/caf/migrations/0002_auto_20200403_1407.py +++ /dev/null @@ -1,58 +0,0 @@ -# Generated by Django 2.2.9 on 2020-04-03 14:07 - -import ctrack.caf.models -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - initial = True - - dependencies = [ - ('caf', '0001_initial'), - ('organisations', '0001_initial'), - ] - - operations = [ - migrations.AddField( - model_name='filestore', - name='physical_location_organisation', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='organisations.Organisation'), - ), - migrations.AddField( - model_name='documentfile', - name='file_store_location', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='caf.FileStore'), - ), - migrations.AddField( - model_name='caf', - name='confidence_grading', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='confidence_grading', to='caf.Grading'), - ), - migrations.AddField( - model_name='caf', - name='file', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='caf.DocumentFile'), - ), - migrations.AddField( - model_name='caf', - name='quality_grading', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='quality_grading', to='caf.Grading'), - ), - migrations.AddField( - model_name='caf', - name='triage_review_inspector', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='organisations.Person'), - ), - migrations.AddField( - model_name='applicablesystem', - name='caf', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='applicable_systems', to='caf.CAF'), - ), - migrations.AddField( - model_name='applicablesystem', - name='organisation', - field=models.ForeignKey(on_delete=models.SET(ctrack.caf.models.ApplicableSystem.get_sentinel_org), to='organisations.Organisation'), - ), - ] diff --git a/ctrack/caf/migrations/0003_auto_20200424_1924.py b/ctrack/caf/migrations/0003_auto_20200424_1924.py deleted file mode 100644 index 34613c6..0000000 --- a/ctrack/caf/migrations/0003_auto_20200424_1924.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 2.2.9 on 2020-04-24 19:24 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('caf', '0002_auto_20200403_1407'), - ] - - operations = [ - migrations.AlterField( - model_name='applicablesystem', - name='description', - field=models.TextField(blank=True, max_length=1000, null=True), - ), - ] diff --git a/ctrack/caf/migrations/0004_auto_20200813_0953.py b/ctrack/caf/migrations/0004_auto_20200813_0953.py deleted file mode 100644 index ad1ca96..0000000 --- a/ctrack/caf/migrations/0004_auto_20200813_0953.py +++ /dev/null @@ -1,31 +0,0 @@ -# Generated by Django 2.2.12 on 2020-08-13 09:53 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('caf', '0003_auto_20200424_1924'), - ] - - operations = [ - migrations.AlterModelOptions( - name='applicablesystem', - options={'verbose_name': 'NIS System'}, - ), - migrations.RemoveField( - model_name='applicablesystem', - name='description', - ), - migrations.AddField( - model_name='applicablesystem', - name='function', - field=models.TextField(blank=True, help_text='How the system is relevant to delivering or supporting the essential service', max_length=1000, null=True), - ), - migrations.AlterField( - model_name='applicablesystem', - name='name', - field=models.CharField(help_text='System name assigned by OES', max_length=256), - ), - ] diff --git a/ctrack/caf/migrations/0005_applicablesystem_oes_categorisation.py b/ctrack/caf/migrations/0005_applicablesystem_oes_categorisation.py deleted file mode 100644 index dc8c928..0000000 --- a/ctrack/caf/migrations/0005_applicablesystem_oes_categorisation.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 2.2.12 on 2020-08-13 11:17 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('caf', '0004_auto_20200813_0953'), - ] - - operations = [ - migrations.AddField( - model_name='applicablesystem', - name='oes_categorisation', - field=models.CharField(choices=[('CR', 'Critical'), ('IM', 'Important')], default='CR', max_length=2), - ), - ] diff --git a/ctrack/caf/migrations/0006_auto_20200813_1125.py b/ctrack/caf/migrations/0006_auto_20200813_1125.py deleted file mode 100644 index 1e97dff..0000000 --- a/ctrack/caf/migrations/0006_auto_20200813_1125.py +++ /dev/null @@ -1,22 +0,0 @@ -# Generated by Django 2.2.12 on 2020-08-13 11:25 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('caf', '0005_applicablesystem_oes_categorisation'), - ] - - operations = [ - migrations.RemoveField( - model_name='applicablesystem', - name='oes_categorisation', - ), - migrations.AddField( - model_name='applicablesystem', - name='dft_categorisation', - field=models.CharField(choices=[('CR', 'Critical'), ('IM', 'Important')], default='CR', help_text='Refer to documentation for description of these criteria', max_length=2, verbose_name='DfT Categorisation'), - ), - ] diff --git a/ctrack/caf/migrations/0007_auto_20200814_1230.py b/ctrack/caf/migrations/0007_auto_20200814_1230.py deleted file mode 100644 index 68a12bd..0000000 --- a/ctrack/caf/migrations/0007_auto_20200814_1230.py +++ /dev/null @@ -1,23 +0,0 @@ -# Generated by Django 2.2.12 on 2020-08-14 12:30 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('caf', '0006_auto_20200813_1125'), - ] - - operations = [ - migrations.AddField( - model_name='applicablesystem', - name='oes_categorisation', - field=models.CharField(default='', help_text="Categorisation based on OES' own internal prioritisation process.", max_length=255, verbose_name='OES Categorisation'), - ), - migrations.AlterField( - model_name='applicablesystem', - name='dft_categorisation', - field=models.CharField(choices=[('CR', 'Critical'), ('IM', 'Important (Legacy use only)')], default='CR', help_text='Refer to documentation for description of these criteria', max_length=2, verbose_name='DfT Categorisation'), - ), - ] diff --git a/ctrack/caf/migrations/0008_auto_20200814_1318.py b/ctrack/caf/migrations/0008_auto_20200814_1318.py deleted file mode 100644 index 90f188f..0000000 --- a/ctrack/caf/migrations/0008_auto_20200814_1318.py +++ /dev/null @@ -1,23 +0,0 @@ -# Generated by Django 2.2.12 on 2020-08-14 13:18 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('caf', '0007_auto_20200814_1230'), - ] - - operations = [ - migrations.AddField( - model_name='applicablesystem', - name='essential_service', - field=models.CharField(default='NA', help_text='Name of the essential service which the system suppports.', max_length=255, verbose_name='Essential Service'), - ), - migrations.AlterField( - model_name='applicablesystem', - name='oes_categorisation', - field=models.CharField(default='NA', help_text="Categorisation based on OES' own internal prioritisation process.", max_length=255, verbose_name='OES Categorisation'), - ), - ] diff --git a/ctrack/caf/migrations/0009_auto_20200826_1255.py b/ctrack/caf/migrations/0009_auto_20200826_1255.py deleted file mode 100644 index 6611b59..0000000 --- a/ctrack/caf/migrations/0009_auto_20200826_1255.py +++ /dev/null @@ -1,30 +0,0 @@ -# Generated by Django 2.2.12 on 2020-08-26 12:55 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('organisations', '0011_auto_20200531_1441'), - ('caf', '0008_auto_20200814_1318'), - ] - - operations = [ - migrations.AlterField( - model_name='applicablesystem', - name='essential_service', - field=models.CharField(default='NA', help_text='Description of the essential service which the system suppports.', max_length=255, verbose_name='Essential Service'), - ), - migrations.CreateModel( - name='EssentialService', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=256)), - ('description', models.CharField(max_length=512)), - ('organisation', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='organisations.Organisation')), - ('systems', models.ManyToManyField(to='caf.ApplicableSystem')), - ], - ), - ] diff --git a/ctrack/caf/models.py b/ctrack/caf/models.py index 892c2cf..fc56c30 100644 --- a/ctrack/caf/models.py +++ b/ctrack/caf/models.py @@ -45,13 +45,6 @@ class DocumentFile(models.Model): class ApplicableSystem(models.Model): - CRITICAL = "CR" - IMPORTANT = "IM" - SYSTEM_CATEGORISATION = ( - (CRITICAL, "Critical"), - (IMPORTANT, "Important (Legacy use only)"), - ) - def get_sentinel_org(): """ We need this so that we can ensure models.SET() is applied with a callable @@ -60,6 +53,13 @@ class ApplicableSystem(models.Model): """ return Organisation.objects.get_or_create(name="DELETED ORGANISATION")[0] + CRITICAL = "CR" + IMPORTANT = "IM" + SYSTEM_CATEGORISATION = ( + (CRITICAL, "Critical"), + (IMPORTANT, "Important (Legacy use only)"), + ) + name = models.CharField(max_length=256, help_text="System name assigned by OES") function = models.TextField( max_length=1000, @@ -68,22 +68,6 @@ class ApplicableSystem(models.Model): help_text="How the system is relevant to delivering or supporting the " "essential service", ) - organisation = models.ForeignKey( - Organisation, on_delete=models.SET(get_sentinel_org) - ) - caf = models.ForeignKey( - "CAF", - on_delete=models.CASCADE, - blank=True, - null=True, - related_name="applicable_systems", - ) - essential_service = models.CharField( - max_length=255, - default="NA", - verbose_name="Essential Service", - help_text="Description of the essential service which the system suppports.", - ) dft_categorisation = models.CharField( max_length=2, choices=SYSTEM_CATEGORISATION, @@ -111,6 +95,14 @@ class ApplicableSystem(models.Model): class CAF(models.Model): + def get_sentinel_org(): + """ + We need this so that we can ensure models.SET() is applied with a callable + to handle when Users are deleted from the system, preventing the Organisation + objects related to them being deleted also. + """ + return Organisation.objects.get_or_create(name="DELETED ORGANISATION")[0] + quality_grading = models.ForeignKey( Grading, on_delete=models.CASCADE, @@ -129,6 +121,9 @@ class CAF(models.Model): DocumentFile, on_delete=models.CASCADE, blank=True, null=True ) version = models.CharField(max_length=10, blank=True, null=True) + organisation = models.ForeignKey( + Organisation, on_delete=models.SET(get_sentinel_org) + ) triage_review_date = models.DateField(blank=True, null=True) triage_review_inspector = models.ForeignKey( Person, on_delete=models.CASCADE, blank=True, null=True @@ -147,17 +142,17 @@ class CAF(models.Model): """ return ApplicableSystem.objects.filter(caf=self) - def organisation(self): - first_ass = ApplicableSystem.objects.filter(caf=self).first() - return first_ass.organisation + # FIXME remove once we know we don't need it + # def organisation(self): + # first_ass = ApplicableSystem.objects.filter(caf=self).first() + # return first_ass.organisation def sub_mode(self): return self.organisation().submode def __str__(self): # Get the organisation and applicable system - ass = ApplicableSystem.objects.filter(caf=self).first() - return f"CAF | {ass.organisation.name}_v{self.version}" + return f"CAF | {self.organisation.name}_v{self.version}" class EssentialService(models.Model): diff --git a/ctrack/caf/tests/factories.py b/ctrack/caf/tests/factories.py index 3c62307..7aaf716 100644 --- a/ctrack/caf/tests/factories.py +++ b/ctrack/caf/tests/factories.py @@ -10,6 +10,7 @@ from ctrack.organisations.tests.factories import OrganisationFactory, PersonFact class CAFFactory(factory.DjangoModelFactory): quality_grading = factory.SubFactory("ctrack.caf.tests.factories.GradingFactory") confidence_grading = factory.SubFactory("ctrack.caf.tests.factories.GradingFactory") + organisation = factory.SubFactory("ctrack.organisations.tests.OrganisationFactory") file = None version = Faker("bothify", text="??##", letters="ABCD") triage_review_date = Faker("date_object") @@ -29,8 +30,6 @@ class ApplicableSystemFactory(factory.DjangoModelFactory): function = Faker( "paragraph", nb_sentences=4, variable_nb_sentences=True, ext_word_list=None ) - organisation = factory.SubFactory(OrganisationFactory) - caf = factory.SubFactory("ctrack.caf.tests.factories.CAFFactory") dft_categorisation = "CR" class Meta: diff --git a/ctrack/core/utils.py b/ctrack/core/utils.py index 0612c52..c0f6cba 100644 --- a/ctrack/core/utils.py +++ b/ctrack/core/utils.py @@ -55,14 +55,13 @@ def _create_caf_app_service(c_descriptors, org, q_descriptors): caf = CAFFactory.create( quality_grading__descriptor=random.choice(q_descriptors), confidence_grading__descriptor=random.choice(c_descriptors), + organisation=org, triage_review_date=None, triage_review_inspector=None, ) - # Each CAF can have up to three systems associated with it - for _ in range(random.randint(1, 3)): - ApplicableSystemFactory.create( - name=random.choice(fnames), organisation=org, caf=caf, - ) + # # Each CAF can have up to three systems associated with it + # for _ in range(random.randint(1, 3)): + # ApplicableSystemFactory.create(name=random.choice(fnames)) def populate_db(**kwargs): diff --git a/ctrack/organisations/admin.py b/ctrack/organisations/admin.py index 203baa9..d3e6284 100644 --- a/ctrack/organisations/admin.py +++ b/ctrack/organisations/admin.py @@ -1,5 +1,7 @@ from django.contrib import admin +from ctrack.caf.models import CAF + from .models import ( Address, AddressType, @@ -18,6 +20,10 @@ def get_organisation_name(person): return Organisation.objects.filter(person__id=person.id).first().name +def get_first_caf(org): + return CAF.objects.filter(organisation__id=org.id).first().version + + # We need this to ensure the column header in the admin does't read the func name get_organisation_name.short_description = "Organisation" diff --git a/ctrack/organisations/migrations/0001_initial.py b/ctrack/organisations/migrations/0001_initial.py index a420fa1..c5ab495 100644 --- a/ctrack/organisations/migrations/0001_initial.py +++ b/ctrack/organisations/migrations/0001_initial.py @@ -1,5 +1,6 @@ -# Generated by Django 2.2.9 on 2020-04-03 14:07 +# Generated by Django 2.2.12 on 2020-08-27 09:40 +import django.contrib.auth from django.db import migrations, models import django.db.models.deletion import django_extensions.db.fields @@ -14,23 +15,6 @@ class Migration(migrations.Migration): operations = [ migrations.CreateModel( - name='Address', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('line1', models.CharField(max_length=255)), - ('line2', models.CharField(blank=True, max_length=255)), - ('line3', models.CharField(blank=True, max_length=255)), - ('city', models.CharField(max_length=100)), - ('county', models.CharField(blank=True, max_length=100)), - ('postcode', models.CharField(max_length=10)), - ('country', models.CharField(max_length=100)), - ('other_details', models.CharField(blank=True, max_length=255)), - ], - options={ - 'verbose_name_plural': 'Addresses', - }, - ), - migrations.CreateModel( name='AddressType', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), @@ -50,31 +34,16 @@ class Migration(migrations.Migration): ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(max_length=255)), ('slug', django_extensions.db.fields.AutoSlugField(blank=True, editable=False, populate_from=['name'])), - ('oes', models.BooleanField()), + ('oes', models.BooleanField(default=True)), ('designation_type', models.IntegerField(choices=[(1, 'Automatic'), (2, 'Reserve Power'), (3, 'NA')], default=1)), ('registered_company_name', models.CharField(blank=True, max_length=255)), ('registered_company_number', models.CharField(blank=True, max_length=100)), ('date_updated', models.DateField(auto_now=True)), - ('comments', models.TextField(max_length=500)), + ('comments', models.TextField(blank=True, max_length=500, null=True)), ('active', models.BooleanField(default=True)), ], ), migrations.CreateModel( - name='Role', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=100)), - ], - ), - migrations.CreateModel( - name='Submode', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('descriptor', models.CharField(max_length=100)), - ('mode', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='organisations.Mode')), - ], - ), - migrations.CreateModel( name='Person', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), @@ -100,10 +69,83 @@ class Migration(migrations.Migration): ('comments', models.TextField(blank=True, max_length=1000)), ('organisation', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='organisations.Organisation')), ('predecessor', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='previous_person', to='organisations.Person')), - ('role', models.ManyToManyField(to='organisations.Role')), ], options={ 'verbose_name_plural': 'People', }, ), + migrations.CreateModel( + name='Role', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=100)), + ], + ), + migrations.CreateModel( + name='Submode', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('descriptor', models.CharField(max_length=100)), + ('mode', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='organisations.Mode')), + ], + ), + migrations.CreateModel( + name='Stakeholder', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('person', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='organisations.Person')), + ], + ), + migrations.AddField( + model_name='person', + name='role', + field=models.ManyToManyField(to='organisations.Role'), + ), + migrations.AddField( + model_name='organisation', + name='submode', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='organisations.Submode'), + ), + migrations.CreateModel( + name='IncidentReport', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('person_involved', models.CharField(blank=True, max_length=100, verbose_name='Name of person reporting/detecting incident')), + ('role', models.CharField(blank=True, help_text='Role of person reporting/detecting incident', max_length=100)), + ('phone_number', models.CharField(max_length=30)), + ('email', models.EmailField(max_length=254)), + ('internal_incident_number', models.CharField(blank=True, max_length=30)), + ('date_time_incident_detected', models.DateTimeField(verbose_name='Date/Time incident detected')), + ('date_time_incident_reported', models.DateTimeField(auto_now=True, verbose_name='Date/Time incident reported')), + ('incident_type', models.CharField(choices=[('Cyber', 'Cyber'), ('Non-Cyber', 'Non-Cyber'), ('Both', 'Both'), ('Power Outage', 'Power Outage')], help_text='This can be appoximate', max_length=20)), + ('incident_status', models.CharField(choices=[('Detected', 'Detected'), ('Suspected', 'Suspected'), ('Resolved', 'Resolved')], max_length=20)), + ('incident_stage', models.CharField(choices=[('Ongoing', 'Ongoing'), ('Ended', 'Ended'), ('Ongoing but managed', 'Ongoing but managed')], max_length=20)), + ('summary', models.TextField(help_text='Please provide a summary of your understanding of the incident, including any impact to services and/or users.')), + ('mitigations', models.TextField(help_text='What investigations and/or mitigations have you or a third party performed or plan to perform?', verbose_name='Investigations or mitigations')), + ('others_informed', models.TextField(help_text='Who else has been informed about this incident?(CSIRT, NCSC, NCA, etc)', verbose_name='Others parties informed')), + ('next_steps', models.TextField(help_text='What are your planned next steps?', verbose_name='Planned next steps')), + ('dft_handle_status', models.CharField(choices=[('QUEUED', 'QUEUED'), ('REVIEWING', 'REVIEWING'), ('WAITING', 'WAITING'), ('COMPLETED', 'COMPLETED')], default='QUEUED', max_length=20)), + ('organisation', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='organisations.Organisation')), + ('reporting_person', models.ForeignKey(on_delete=models.SET(django.contrib.auth.get_user_model), to='organisations.Person', verbose_name='Person reporting the incident')), + ], + ), + migrations.CreateModel( + name='Address', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('line1', models.CharField(max_length=255)), + ('line2', models.CharField(blank=True, max_length=255)), + ('line3', models.CharField(blank=True, max_length=255)), + ('city', models.CharField(max_length=100)), + ('county', models.CharField(blank=True, max_length=100)), + ('postcode', models.CharField(max_length=10)), + ('country', models.CharField(max_length=100)), + ('other_details', models.CharField(blank=True, max_length=255)), + ('organisation', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='addresses', to='organisations.Organisation')), + ('type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='organisations.AddressType', verbose_name='Address Type')), + ], + options={ + 'verbose_name_plural': 'Addresses', + }, + ), ] diff --git a/ctrack/organisations/migrations/0002_auto_20200403_1407.py b/ctrack/organisations/migrations/0002_auto_20200403_1407.py deleted file mode 100644 index d9f3aed..0000000 --- a/ctrack/organisations/migrations/0002_auto_20200403_1407.py +++ /dev/null @@ -1,44 +0,0 @@ -# Generated by Django 2.2.9 on 2020-04-03 14:07 - -import ctrack.organisations.models -from django.conf import settings -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - initial = True - - dependencies = [ - migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ('organisations', '0001_initial'), - ] - - operations = [ - migrations.AddField( - model_name='person', - name='updated_by', - field=models.ForeignKey(on_delete=models.SET(ctrack.organisations.models.Person.get_sentinel_user), to=settings.AUTH_USER_MODEL), - ), - migrations.AddField( - model_name='organisation', - name='submode', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='organisations.Submode'), - ), - migrations.AddField( - model_name='organisation', - name='updated_by', - field=models.ForeignKey(on_delete=models.SET(ctrack.organisations.models.Organisation.get_sentinel_user), to=settings.AUTH_USER_MODEL), - ), - migrations.AddField( - model_name='address', - name='organisation', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='addresses', to='organisations.Organisation'), - ), - migrations.AddField( - model_name='address', - name='type', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='organisations.AddressType', verbose_name='Address Type'), - ), - ] diff --git a/ctrack/organisations/migrations/0003_auto_20200424_1607.py b/ctrack/organisations/migrations/0003_auto_20200424_1607.py deleted file mode 100644 index 75268a0..0000000 --- a/ctrack/organisations/migrations/0003_auto_20200424_1607.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 2.2.9 on 2020-04-24 16:07 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('organisations', '0002_auto_20200403_1407'), - ] - - operations = [ - migrations.AlterField( - model_name='organisation', - name='comments', - field=models.TextField(blank=True, max_length=500, null=True), - ), - ] diff --git a/ctrack/organisations/migrations/0004_auto_20200513_1441.py b/ctrack/organisations/migrations/0004_auto_20200513_1441.py deleted file mode 100644 index 180211a..0000000 --- a/ctrack/organisations/migrations/0004_auto_20200513_1441.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 3.0.5 on 2020-05-13 14:41 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('organisations', '0003_auto_20200424_1607'), - ] - - operations = [ - migrations.AlterField( - model_name='organisation', - name='oes', - field=models.BooleanField(default=True), - ), - ] diff --git a/ctrack/organisations/migrations/0005_auto_20200525_1502.py b/ctrack/organisations/migrations/0005_auto_20200525_1502.py deleted file mode 100644 index 921fdbb..0000000 --- a/ctrack/organisations/migrations/0005_auto_20200525_1502.py +++ /dev/null @@ -1,29 +0,0 @@ -# Generated by Django 3.0.5 on 2020-05-25 15:02 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('organisations', '0004_auto_20200513_1441'), - ] - - operations = [ - migrations.RemoveField( - model_name='organisation', - name='updated_by', - ), - migrations.RemoveField( - model_name='person', - name='updated_by', - ), - migrations.CreateModel( - name='Stakeholder', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('person', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='organisations.Person')), - ], - ), - ] diff --git a/ctrack/organisations/migrations/0006_incidentreport.py b/ctrack/organisations/migrations/0006_incidentreport.py deleted file mode 100644 index 0528aaa..0000000 --- a/ctrack/organisations/migrations/0006_incidentreport.py +++ /dev/null @@ -1,35 +0,0 @@ -# Generated by Django 2.2.12 on 2020-05-29 12:56 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('organisations', '0005_auto_20200525_1502'), - ] - - operations = [ - migrations.CreateModel( - name='IncidentReport', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('role', models.CharField(help_text='Please identify your role', max_length=100)), - ('phone_number', models.CharField(max_length=30)), - ('email', models.EmailField(max_length=254)), - ('internal_incident_number', models.CharField(blank=True, max_length=30)), - ('date_time_incident_detected', models.DateTimeField(help_text='This can be approximate', verbose_name='Date/Time incident detected')), - ('date_time_incident_reported', models.DateTimeField(verbose_name='Date/Time incident reported')), - ('incident_type', models.CharField(choices=[('cyber', 'Cyber'), ('non-cyber', 'Non-Cyber'), ('both', 'Both'), ('power', 'Power Outage')], help_text='This can be appoximate', max_length=10)), - ('incident_status', models.CharField(choices=[('detected', 'Detected'), ('suspected', 'Suspected'), ('resolved', 'Resolved')], max_length=10)), - ('incident_stage', models.CharField(choices=[('ongoing', 'Ongoing'), ('ended', 'Ended'), ('managed', 'Ongoing but managed')], max_length=10)), - ('summary', models.TextField(help_text='Please provide a summary of your understanding of the incident, including any impact to services and/or users.')), - ('mitigations', models.TextField(help_text='What investigations and/or mitigations have you or a third party performed or plan to perform?', verbose_name='Investigations or mitigations')), - ('others_informed', models.TextField(help_text='Who else has been informed about this incident?(CSIRT, NCSC, NCA, etc)', verbose_name='Others parties informed')), - ('next_steps', models.TextField(help_text='What are your planned next steps?', verbose_name='Planned next steps')), - ('organisation', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='organisations.Organisation')), - ('reporting_person', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='organisations.Person', verbose_name='Person reporting the incident')), - ], - ), - ] diff --git a/ctrack/organisations/migrations/0007_auto_20200529_1520.py b/ctrack/organisations/migrations/0007_auto_20200529_1520.py deleted file mode 100644 index 59a5089..0000000 --- a/ctrack/organisations/migrations/0007_auto_20200529_1520.py +++ /dev/null @@ -1,23 +0,0 @@ -# Generated by Django 2.2.12 on 2020-05-29 15:20 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('organisations', '0006_incidentreport'), - ] - - operations = [ - migrations.AddField( - model_name='incidentreport', - name='dft_handle_status', - field=models.CharField(choices=[('queued', 'QUEUED'), ('reviewing', 'REVIEWING'), ('waiting', 'WAITING'), ('completed', 'COMPLETE')], default='queued', max_length=20), - ), - migrations.AlterField( - model_name='incidentreport', - name='date_time_incident_reported', - field=models.DateTimeField(auto_now=True, verbose_name='Date/Time incident reported'), - ), - ] diff --git a/ctrack/organisations/migrations/0008_auto_20200529_1545.py b/ctrack/organisations/migrations/0008_auto_20200529_1545.py deleted file mode 100644 index 1c4cec6..0000000 --- a/ctrack/organisations/migrations/0008_auto_20200529_1545.py +++ /dev/null @@ -1,38 +0,0 @@ -# Generated by Django 2.2.12 on 2020-05-29 15:45 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('organisations', '0007_auto_20200529_1520'), - ] - - operations = [ - migrations.AlterField( - model_name='incidentreport', - name='date_time_incident_detected', - field=models.DateTimeField(verbose_name='Date/Time incident detected'), - ), - migrations.AlterField( - model_name='incidentreport', - name='dft_handle_status', - field=models.CharField(choices=[('QUEUED', 'QUEUED'), ('REVIEWING', 'REVIEWING'), ('WAITING', 'WAITING'), ('COMPLETED', 'COMPLETED')], default='QUEUED', max_length=20), - ), - migrations.AlterField( - model_name='incidentreport', - name='incident_stage', - field=models.CharField(choices=[('Ongoing', 'Ongoing'), ('Ended', 'Ended'), ('Ongoing but managed', 'Ongoing but managed')], max_length=20), - ), - migrations.AlterField( - model_name='incidentreport', - name='incident_status', - field=models.CharField(choices=[('Detected', 'Detected'), ('Suspected', 'Suspected'), ('Resolved', 'Resolved')], max_length=20), - ), - migrations.AlterField( - model_name='incidentreport', - name='incident_type', - field=models.CharField(choices=[('Cyber', 'Cyber'), ('Non-Cyber', 'Non-Cyber'), ('Both', 'Both'), ('Power Outage', 'Power Outage')], help_text='This can be appoximate', max_length=20), - ), - ] diff --git a/ctrack/organisations/migrations/0009_incidentreport_person_involved.py b/ctrack/organisations/migrations/0009_incidentreport_person_involved.py deleted file mode 100644 index ea4799c..0000000 --- a/ctrack/organisations/migrations/0009_incidentreport_person_involved.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 2.2.12 on 2020-05-29 16:01 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('organisations', '0008_auto_20200529_1545'), - ] - - operations = [ - migrations.AddField( - model_name='incidentreport', - name='person_involved', - field=models.CharField(blank=True, max_length=100, verbose_name='Name of person reporting/detecting incident'), - ), - ] diff --git a/ctrack/organisations/migrations/0010_auto_20200529_1602.py b/ctrack/organisations/migrations/0010_auto_20200529_1602.py deleted file mode 100644 index 2986d36..0000000 --- a/ctrack/organisations/migrations/0010_auto_20200529_1602.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 2.2.12 on 2020-05-29 16:02 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('organisations', '0009_incidentreport_person_involved'), - ] - - operations = [ - migrations.AlterField( - model_name='incidentreport', - name='role', - field=models.CharField(blank=True, help_text='Role of person reporting/detecting incident', max_length=100), - ), - ] diff --git a/ctrack/organisations/migrations/0011_auto_20200531_1441.py b/ctrack/organisations/migrations/0011_auto_20200531_1441.py deleted file mode 100644 index 3dced7d..0000000 --- a/ctrack/organisations/migrations/0011_auto_20200531_1441.py +++ /dev/null @@ -1,19 +0,0 @@ -# Generated by Django 2.2.12 on 2020-05-31 14:41 - -import django.contrib.auth -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('organisations', '0010_auto_20200529_1602'), - ] - - operations = [ - migrations.AlterField( - model_name='incidentreport', - name='reporting_person', - field=models.ForeignKey(on_delete=models.SET(django.contrib.auth.get_user_model), to='organisations.Person', verbose_name='Person reporting the incident'), - ), - ] diff --git a/ctrack/register/migrations/0001_initial.py b/ctrack/register/migrations/0001_initial.py index 7db1237..4a878d7 100644 --- a/ctrack/register/migrations/0001_initial.py +++ b/ctrack/register/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 2.2.9 on 2020-04-03 14:07 +# Generated by Django 2.2.12 on 2020-08-27 09:40 from django.db import migrations, models import django.db.models.deletion @@ -9,8 +9,8 @@ class Migration(migrations.Migration): initial = True dependencies = [ - ('caf', '0002_auto_20200403_1407'), ('organisations', '0001_initial'), + ('caf', '0001_initial'), ] operations = [ diff --git a/ctrack/register/migrations/0002_engagementevent_user.py b/ctrack/register/migrations/0002_engagementevent_user.py index 59c93d6..01de5b9 100644 --- a/ctrack/register/migrations/0002_engagementevent_user.py +++ b/ctrack/register/migrations/0002_engagementevent_user.py @@ -1,4 +1,4 @@ -# Generated by Django 2.2.9 on 2020-04-03 14:07 +# Generated by Django 2.2.12 on 2020-08-27 09:40 import ctrack.register.models from django.conf import settings diff --git a/ctrack/users/migrations/0001_initial.py b/ctrack/users/migrations/0001_initial.py index 2f760c2..bc74b13 100644 --- a/ctrack/users/migrations/0001_initial.py +++ b/ctrack/users/migrations/0001_initial.py @@ -1,8 +1,9 @@ -# Generated by Django 2.2.9 on 2020-04-03 14:07 +# Generated by Django 2.2.12 on 2020-08-27 09:40 import django.contrib.auth.models import django.contrib.auth.validators from django.db import migrations, models +import django.db.models.deletion import django.utils.timezone @@ -11,6 +12,7 @@ class Migration(migrations.Migration): initial = True dependencies = [ + ('organisations', '0001_initial'), ('auth', '0011_update_proxy_permissions'), ] @@ -31,6 +33,7 @@ class Migration(migrations.Migration): ('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')), ('name', models.CharField(blank=True, max_length=255, verbose_name='Name of User')), ('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.Group', verbose_name='groups')), + ('stakeholder', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='organisations.Stakeholder')), ('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.Permission', verbose_name='user permissions')), ], options={ diff --git a/ctrack/users/migrations/0002_user_is_person.py b/ctrack/users/migrations/0002_user_is_person.py deleted file mode 100644 index 2223429..0000000 --- a/ctrack/users/migrations/0002_user_is_person.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 3.0.5 on 2020-05-22 15:19 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('users', '0001_initial'), - ] - - operations = [ - migrations.AddField( - model_name='user', - name='is_person', - field=models.BooleanField(default=False), - ), - ] diff --git a/ctrack/users/migrations/0003_auto_20200522_1527.py b/ctrack/users/migrations/0003_auto_20200522_1527.py deleted file mode 100644 index dc4f7c1..0000000 --- a/ctrack/users/migrations/0003_auto_20200522_1527.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 3.0.5 on 2020-05-22 15:27 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('users', '0002_user_is_person'), - ] - - operations = [ - migrations.RenameField( - model_name='user', - old_name='is_person', - new_name='oes_user', - ), - ] diff --git a/ctrack/users/migrations/0004_auto_20200524_1945.py b/ctrack/users/migrations/0004_auto_20200524_1945.py deleted file mode 100644 index 8839fd2..0000000 --- a/ctrack/users/migrations/0004_auto_20200524_1945.py +++ /dev/null @@ -1,23 +0,0 @@ -# Generated by Django 3.0.5 on 2020-05-24 19:45 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('users', '0003_auto_20200522_1527'), - ] - - operations = [ - migrations.CreateModel( - name='UserProfile', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ], - ), - migrations.RemoveField( - model_name='user', - name='oes_user', - ), - ] diff --git a/ctrack/users/migrations/0005_delete_userprofile.py b/ctrack/users/migrations/0005_delete_userprofile.py deleted file mode 100644 index 42f62bb..0000000 --- a/ctrack/users/migrations/0005_delete_userprofile.py +++ /dev/null @@ -1,16 +0,0 @@ -# Generated by Django 3.0.5 on 2020-05-25 14:41 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('users', '0004_auto_20200524_1945'), - ] - - operations = [ - migrations.DeleteModel( - name='UserProfile', - ), - ] diff --git a/ctrack/users/migrations/0006_user_stakeholder.py b/ctrack/users/migrations/0006_user_stakeholder.py deleted file mode 100644 index d8a3089..0000000 --- a/ctrack/users/migrations/0006_user_stakeholder.py +++ /dev/null @@ -1,20 +0,0 @@ -# Generated by Django 3.0.5 on 2020-05-25 15:02 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('organisations', '0005_auto_20200525_1502'), - ('users', '0005_delete_userprofile'), - ] - - operations = [ - migrations.AddField( - model_name='user', - name='stakeholder', - field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='organisations.Stakeholder'), - ), - ] |