diff options
45 files changed, 266 insertions, 846 deletions
diff --git a/ctrack/assessments/admin.py b/ctrack/assessments/admin.py index a78dfe0..10c19d0 100644 --- a/ctrack/assessments/admin.py +++ b/ctrack/assessments/admin.py @@ -1,11 +1,11 @@ from django.contrib import admin -from ctrack.assessments.models import CAFSelfAssessment, CAFObjective, CAFPrinciple, CAFContributingOutcome, \ - CAFSelfAssessmentOutcomeScore +from ctrack.assessments.models import CAFAssessment, CAFObjective, CAFPrinciple, CAFContributingOutcome, \ + CAFAssessmentOutcomeScore -class CAFSelfAssessmentAdmin(admin.ModelAdmin): - model = CAFSelfAssessment +class CAFAssessmentAdmin(admin.ModelAdmin): + model = CAFAssessment class CAFObjectiveAdmin(admin.ModelAdmin): @@ -20,12 +20,12 @@ class CAFContributingOutcomeAdmin(admin.ModelAdmin): model = CAFContributingOutcome -class CAFSelfAssessmentOutcomeScoreAdmin(admin.ModelAdmin): - model = CAFSelfAssessmentOutcomeScore +class CAFAssessmentOutcomeScoreAdmin(admin.ModelAdmin): + model = CAFAssessmentOutcomeScore -admin.site.register(CAFSelfAssessment, CAFSelfAssessmentAdmin) +admin.site.register(CAFAssessment, CAFAssessmentAdmin) admin.site.register(CAFObjective, CAFObjectiveAdmin) admin.site.register(CAFPrinciple, CAFPrincipleAdmin) admin.site.register(CAFContributingOutcome, CAFContributingOutcomeAdmin) -admin.site.register(CAFSelfAssessmentOutcomeScore, CAFSelfAssessmentOutcomeScoreAdmin) +admin.site.register(CAFAssessmentOutcomeScore, CAFAssessmentOutcomeScoreAdmin) diff --git a/ctrack/assessments/migrations/0001_initial.py b/ctrack/assessments/migrations/0001_initial.py index 9943e4b..94afdf9 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-03-12 14:57 +# Generated by Django 2.2.9 on 2020-04-03 14:07 from django.db import migrations, models import django.db.models.deletion @@ -9,60 +9,70 @@ class Migration(migrations.Migration): initial = True dependencies = [ - ('organisations', '0006_organisation_oes'), - ('caf', '0018_remove_caf_owner'), ] operations = [ migrations.CreateModel( - name='CAFContributingOutcome', + name='CAFAssessment', 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)), - ('descriptor', models.CharField(help_text='e.g. Board Direction', max_length=50)), - ('order_id', models.IntegerField()), + ('comments', models.TextField(max_length=500)), ], + options={ + 'verbose_name': 'CAF Assessment', + }, ), migrations.CreateModel( name='CAFObjective', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(help_text='e.g. Managing Risk', max_length=20)), + ('name', models.CharField(help_text='e.g. Managing Risk', max_length=100)), ('description', models.TextField(max_length=500)), ('order_id', models.IntegerField()), ], + options={ + 'verbose_name': 'CAF Objective', + }, ), migrations.CreateModel( - name='CAFSelfAssessment', + name='CAFPrinciple', 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')), + ('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')), ], + options={ + 'verbose_name': 'CAF Principle', + }, ), migrations.CreateModel( - name='CAFSelfAssessmentOutcomeScore', + name='CAFContributingOutcome', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('caf_contributing_outcome', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='assessments.CAFContributingOutcome')), - ('caf_self_assessment', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='assessments.CAFSelfAssessment')), + ('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()), + ('principle', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='assessments.CAFPrinciple')), ], + options={ + 'verbose_name': 'CAF Contributing Outcome', + }, ), migrations.CreateModel( - name='CAFPrinciple', + name='CAFAssessmentOutcomeScore', 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')), + ('assessment_score', models.CharField(choices=[('Achieved', 'Achieved'), ('Partially Achieved', 'Partially Achieved'), ('Not Achieved', 'Not Achieved')], help_text='Choose an assessment score', max_length=20, verbose_name='Assessment Score')), + ('baseline_assessment_score', models.CharField(choices=[('Achieved', 'Achieved'), ('Partially Achieved', 'Partially Achieved'), ('Not Achieved', 'Not Achieved')], help_text='Choose an assessment score', max_length=20, verbose_name='Baseline Score')), + ('caf_assessment', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='assessments.CAFAssessment', verbose_name='CAF Assessment')), + ('caf_contributing_outcome', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='assessments.CAFContributingOutcome', verbose_name='CAF Contributing Outcome')), ], - ), - migrations.AddField( - model_name='cafcontributingoutcome', - name='principle', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='assessments.CAFPrinciple'), + options={ + 'verbose_name': 'CAF Assessment Outcome Score', + }, ), ] diff --git a/ctrack/assessments/migrations/0002_auto_20200315_1617.py b/ctrack/assessments/migrations/0002_auto_20200315_1617.py deleted file mode 100644 index 4acd7bb..0000000 --- a/ctrack/assessments/migrations/0002_auto_20200315_1617.py +++ /dev/null @@ -1,38 +0,0 @@ -# Generated by Django 2.2.9 on 2020-03-15 16:17 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('assessments', '0001_initial'), - ] - - operations = [ - migrations.AlterModelOptions( - name='cafcontributingoutcome', - options={'verbose_name': 'CAF Contributing Outcome'}, - ), - migrations.AlterModelOptions( - name='cafobjective', - options={'verbose_name': 'CAF Objective'}, - ), - migrations.AlterModelOptions( - name='cafprinciple', - options={'verbose_name': 'CAF Principle'}, - ), - migrations.AlterModelOptions( - name='cafselfassessment', - options={'verbose_name': 'CAF Self Assessment'}, - ), - migrations.AlterModelOptions( - name='cafselfassessmentoutcomescore', - options={'verbose_name': 'CAF Self Assessment Outcome Score'}, - ), - migrations.AlterField( - model_name='cafobjective', - name='name', - field=models.CharField(help_text='e.g. Managing Risk', max_length=100), - ), - ] diff --git a/ctrack/assessments/migrations/0002_cafassessment_caf.py b/ctrack/assessments/migrations/0002_cafassessment_caf.py new file mode 100644 index 0000000..db08459 --- /dev/null +++ b/ctrack/assessments/migrations/0002_cafassessment_caf.py @@ -0,0 +1,22 @@ +# 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_auto_20200315_1651.py b/ctrack/assessments/migrations/0003_auto_20200315_1651.py deleted file mode 100644 index 2ac72fc..0000000 --- a/ctrack/assessments/migrations/0003_auto_20200315_1651.py +++ /dev/null @@ -1,24 +0,0 @@ -# Generated by Django 2.2.9 on 2020-03-15 16:51 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('assessments', '0002_auto_20200315_1617'), - ] - - operations = [ - migrations.RenameField( - model_name='cafcontributingoutcome', - old_name='descriptor', - new_name='name', - ), - migrations.AddField( - model_name='cafcontributingoutcome', - name='description', - field=models.TextField(default='', max_length=1000), - preserve_default=False, - ), - ] diff --git a/ctrack/assessments/migrations/0003_cafassessment_completer.py b/ctrack/assessments/migrations/0003_cafassessment_completer.py new file mode 100644 index 0000000..63b3b18 --- /dev/null +++ b/ctrack/assessments/migrations/0003_cafassessment_completer.py @@ -0,0 +1,22 @@ +# 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_auto_20200315_2003.py b/ctrack/assessments/migrations/0004_auto_20200315_2003.py deleted file mode 100644 index 9bb24f9..0000000 --- a/ctrack/assessments/migrations/0004_auto_20200315_2003.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 2.2.9 on 2020-03-15 20:03 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('assessments', '0003_auto_20200315_1651'), - ] - - operations = [ - migrations.AlterField( - model_name='cafcontributingoutcome', - name='name', - field=models.CharField(help_text='e.g. Board Direction', max_length=100), - ), - ] diff --git a/ctrack/assessments/migrations/0005_auto_20200317_1643.py b/ctrack/assessments/migrations/0005_auto_20200317_1643.py deleted file mode 100644 index c7af02b..0000000 --- a/ctrack/assessments/migrations/0005_auto_20200317_1643.py +++ /dev/null @@ -1,25 +0,0 @@ -# Generated by Django 2.2.9 on 2020-03-17 16:43 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('assessments', '0004_auto_20200315_2003'), - ] - - operations = [ - migrations.AddField( - model_name='cafselfassessmentoutcomescore', - name='baseline_assessment_score', - field=models.CharField(choices=[('Achieved', 'Achieved'), ('Partially Achieved', 'Partially Achieved'), ('Not Achieved', 'Not Achieved')], default='Achieved', help_text='Choose an assessment score', max_length=20), - preserve_default=False, - ), - migrations.AddField( - model_name='cafselfassessmentoutcomescore', - name='self_assessment_score', - field=models.CharField(choices=[('Achieved', 'Achieved'), ('Partially Achieved', 'Partially Achieved'), ('Not Achieved', 'Not Achieved')], default='Achieved', help_text='Choose an assessment score', max_length=20), - preserve_default=False, - ), - ] diff --git a/ctrack/assessments/migrations/0006_auto_20200403_0943.py b/ctrack/assessments/migrations/0006_auto_20200403_0943.py deleted file mode 100644 index c819520..0000000 --- a/ctrack/assessments/migrations/0006_auto_20200403_0943.py +++ /dev/null @@ -1,34 +0,0 @@ -# Generated by Django 2.2.9 on 2020-04-03 09:43 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('assessments', '0005_auto_20200317_1643'), - ] - - operations = [ - migrations.AlterField( - model_name='cafselfassessmentoutcomescore', - name='baseline_assessment_score', - field=models.CharField(choices=[('Achieved', 'Achieved'), ('Partially Achieved', 'Partially Achieved'), ('Not Achieved', 'Not Achieved')], help_text='Choose an assessment score', max_length=20, verbose_name='Baseline Score'), - ), - migrations.AlterField( - model_name='cafselfassessmentoutcomescore', - name='caf_contributing_outcome', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='assessments.CAFContributingOutcome', verbose_name='CAF Contributing Outcome'), - ), - migrations.AlterField( - model_name='cafselfassessmentoutcomescore', - name='caf_self_assessment', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='assessments.CAFSelfAssessment', verbose_name='CAF Self Assessment'), - ), - migrations.AlterField( - model_name='cafselfassessmentoutcomescore', - name='self_assessment_score', - field=models.CharField(choices=[('Achieved', 'Achieved'), ('Partially Achieved', 'Partially Achieved'), ('Not Achieved', 'Not Achieved')], help_text='Choose an assessment score', max_length=20, verbose_name='Self Assessment Score'), - ), - ] diff --git a/ctrack/assessments/models.py b/ctrack/assessments/models.py index 8eb04a3..ab57fd5 100644 --- a/ctrack/assessments/models.py +++ b/ctrack/assessments/models.py @@ -4,7 +4,7 @@ from ctrack.caf.models import CAF from ctrack.organisations.models import Person -class CAFSelfAssessment(models.Model): +class CAFAssessment(models.Model): """ These are carried out by an OES as result in, or are associated with a CAF. """ @@ -13,10 +13,10 @@ class CAFSelfAssessment(models.Model): comments = models.TextField(max_length=500) class Meta: - verbose_name = "CAF Self Assessment" + verbose_name = "CAF Assessment" def __str__(self): - return f"CAF Self Assessment for {self.caf.applicable_systems.first().organisation.name} - version {self.caf.version}" + return f"CAF Assessment for {self.caf.applicable_systems.first().organisation.name} - version {self.caf.version}" class CAFObjective(models.Model): @@ -68,7 +68,7 @@ class CAFContributingOutcome(models.Model): return " ".join([self.designation, self.name]) -class CAFSelfAssessmentOutcomeScore(models.Model): +class CAFAssessmentOutcomeScore(models.Model): """ Details the assessment for an Outcome, and the baseline assessment. Completed by an OES initially, but can be completed by anyone. @@ -78,18 +78,18 @@ class CAFSelfAssessmentOutcomeScore(models.Model): ("Partially Achieved", "Partially Achieved"), ("Not Achieved", "Not Achieved"), ) - caf_self_assessment = models.ForeignKey(CAFSelfAssessment, on_delete=models.CASCADE, - verbose_name="CAF Self Assessment") + caf_assessment = models.ForeignKey(CAFAssessment, on_delete=models.CASCADE, + verbose_name="CAF Assessment") caf_contributing_outcome = models.ForeignKey(CAFContributingOutcome, on_delete=models.CASCADE, verbose_name="CAF Contributing Outcome") - self_assessment_score = models.CharField(max_length=20, choices=ASSESSMENT_SCORE, - help_text="Choose an assessment score", - verbose_name="Self Assessment Score") + assessment_score = models.CharField(max_length=20, choices=ASSESSMENT_SCORE, + help_text="Choose an assessment score", + verbose_name="Assessment Score") baseline_assessment_score = models.CharField(max_length=20, choices=ASSESSMENT_SCORE, help_text="Choose an assessment score", verbose_name="Baseline Score") class Meta: - verbose_name = "CAF Self Assessment Outcome Score" + verbose_name = "CAF Assessment Outcome Score" def __str__(self): - return f"{self.caf_contributing_outcome} | {self.caf_self_assessment} | {self.self_assessment_score}" + return f"{self.caf_contributing_outcome} | {self.caf_assessment} | {self.assessment_score}" diff --git a/ctrack/caf/migrations/0001_initial.py b/ctrack/caf/migrations/0001_initial.py index fa19b64..5e184df 100644 --- a/ctrack/caf/migrations/0001_initial.py +++ b/ctrack/caf/migrations/0001_initial.py @@ -1,7 +1,6 @@ -# Generated by Django 2.2.9 on 2020-02-20 14:34 +# 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): @@ -13,42 +12,52 @@ class Migration(migrations.Migration): operations = [ migrations.CreateModel( - name='CAF', + name='ApplicableSystem', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('essential_system', models.CharField(blank=True, max_length=255)), + ('name', models.CharField(max_length=256)), + ('description', models.TextField(max_length=1000)), ], options={ - 'verbose_name': 'CAF', + 'verbose_name': 'Applicable System', }, ), migrations.CreateModel( - name='CAFFileStore', + name='CAF', 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)), + ('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)), ], options={ - 'verbose_name': 'CAF File Store', + 'verbose_name': 'CAF', }, ), migrations.CreateModel( - name='Ranking', + name='DocumentFile', + 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)), + ], + ), + migrations.CreateModel( + name='FileStore', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('descriptor', models.CharField(max_length=100)), - ('type', models.IntegerField(choices=[(1, 'Triage'), (2, 'First Assessment')], default=1)), + ('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)), ], ), migrations.CreateModel( - name='DocumentFile', + name='Grading', 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)), - ('file_store_location', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='caf.CAFFileStore')), + ('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)), ], ), ] diff --git a/ctrack/caf/migrations/0002_auto_20200220_1434.py b/ctrack/caf/migrations/0002_auto_20200220_1434.py deleted file mode 100644 index 9ff54da..0000000 --- a/ctrack/caf/migrations/0002_auto_20200220_1434.py +++ /dev/null @@ -1,37 +0,0 @@ -# Generated by Django 2.2.9 on 2020-02-20 14:34 - -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='caffilestore', - name='physical_location_organisation', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='organisations.Organisation'), - ), - migrations.AddField( - model_name='caf', - name='file', - field=models.ForeignKey(blank=True, on_delete=django.db.models.deletion.CASCADE, to='caf.DocumentFile'), - ), - migrations.AddField( - model_name='caf', - name='owner', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='organisations.Organisation'), - ), - migrations.AddField( - model_name='caf', - name='triage_ranking', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='caf.Ranking'), - ), - ] diff --git a/ctrack/caf/migrations/0002_auto_20200403_1407.py b/ctrack/caf/migrations/0002_auto_20200403_1407.py new file mode 100644 index 0000000..e5963d5 --- /dev/null +++ b/ctrack/caf/migrations/0002_auto_20200403_1407.py @@ -0,0 +1,58 @@ +# 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_20200221_2104.py b/ctrack/caf/migrations/0003_auto_20200221_2104.py deleted file mode 100644 index 9f5d6ae..0000000 --- a/ctrack/caf/migrations/0003_auto_20200221_2104.py +++ /dev/null @@ -1,33 +0,0 @@ -# Generated by Django 2.2.9 on 2020-02-21 21:04 - -import ctrack.caf.models -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('organisations', '0004_auto_20200220_1634'), - ('caf', '0002_auto_20200220_1434'), - ] - - operations = [ - migrations.RemoveField( - model_name='caf', - name='essential_system', - ), - 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.TextField(max_length=1000)), - ('caf', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='caf.CAF')), - ('organisation', models.ForeignKey(on_delete=models.SET(ctrack.caf.models.ApplicableSystem.get_sentinel_org), to='organisations.Organisation')), - ], - options={ - 'verbose_name': 'ApplicableSystem', - }, - ), - ] diff --git a/ctrack/caf/migrations/0004_auto_20200221_2106.py b/ctrack/caf/migrations/0004_auto_20200221_2106.py deleted file mode 100644 index 84fa73e..0000000 --- a/ctrack/caf/migrations/0004_auto_20200221_2106.py +++ /dev/null @@ -1,24 +0,0 @@ -# Generated by Django 2.2.9 on 2020-02-21 21:06 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('caf', '0003_auto_20200221_2104'), - ] - - operations = [ - migrations.AlterField( - model_name='caf', - name='file', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='caf.DocumentFile'), - ), - migrations.AlterField( - model_name='caf', - name='triage_ranking', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='caf.Ranking'), - ), - ] diff --git a/ctrack/caf/migrations/0005_auto_20200221_2115.py b/ctrack/caf/migrations/0005_auto_20200221_2115.py deleted file mode 100644 index 8b94dcf..0000000 --- a/ctrack/caf/migrations/0005_auto_20200221_2115.py +++ /dev/null @@ -1,39 +0,0 @@ -# Generated by Django 2.2.9 on 2020-02-21 21:15 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('caf', '0004_auto_20200221_2106'), - ] - - operations = [ - migrations.CreateModel( - name='ConfidenceAssessment', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('descriptor', models.CharField(max_length=100)), - ('description', models.TextField(max_length=250)), - ('type', models.IntegerField(choices=[(1, 'Good'), (2, 'Bad'), (3, 'OK')], default=1)), - ], - ), - migrations.AddField( - model_name='ranking', - name='description', - field=models.TextField(default='NA', max_length=250), - preserve_default=False, - ), - migrations.AlterField( - model_name='ranking', - name='type', - field=models.IntegerField(choices=[(1, 'Triage'), (2, 'First Assessment'), (3, 'Validation')], default=1), - ), - migrations.AddField( - model_name='caf', - name='confidence_assessment', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='caf.ConfidenceAssessment'), - ), - ] diff --git a/ctrack/caf/migrations/0006_auto_20200221_2120.py b/ctrack/caf/migrations/0006_auto_20200221_2120.py deleted file mode 100644 index cd1daf5..0000000 --- a/ctrack/caf/migrations/0006_auto_20200221_2120.py +++ /dev/null @@ -1,22 +0,0 @@ -# Generated by Django 2.2.9 on 2020-02-21 21:20 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('caf', '0005_auto_20200221_2115'), - ] - - operations = [ - migrations.RemoveField( - model_name='confidenceassessment', - name='type', - ), - migrations.AlterField( - model_name='confidenceassessment', - name='descriptor', - field=models.IntegerField(choices=[(1, 'Good'), (2, 'Bad'), (3, 'OK')], default=1), - ), - ] diff --git a/ctrack/caf/migrations/0007_auto_20200221_2122.py b/ctrack/caf/migrations/0007_auto_20200221_2122.py deleted file mode 100644 index a89db00..0000000 --- a/ctrack/caf/migrations/0007_auto_20200221_2122.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 2.2.9 on 2020-02-21 21:22 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('caf', '0006_auto_20200221_2120'), - ] - - operations = [ - migrations.AlterField( - model_name='confidenceassessment', - name='descriptor', - field=models.CharField(choices=[('GOOD', 'Good'), ('BAD', 'Bad'), ('OK', 'OK')], default=1, max_length=10), - ), - ] diff --git a/ctrack/caf/migrations/0008_auto_20200225_0722.py b/ctrack/caf/migrations/0008_auto_20200225_0722.py deleted file mode 100644 index e1e0c95..0000000 --- a/ctrack/caf/migrations/0008_auto_20200225_0722.py +++ /dev/null @@ -1,46 +0,0 @@ -# Generated by Django 2.2.9 on 2020-02-25 07:22 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('caf', '0007_auto_20200221_2122'), - ] - - operations = [ - migrations.CreateModel( - name='Grading', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('descriptor', models.CharField(max_length=2)), - ('description', models.TextField(max_length=250)), - ], - ), - migrations.RemoveField( - model_name='caf', - name='confidence_assessment', - ), - migrations.RemoveField( - model_name='caf', - name='triage_ranking', - ), - migrations.DeleteModel( - name='ConfidenceAssessment', - ), - migrations.DeleteModel( - name='Ranking', - ), - 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='triage_grading', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='triage_grading', to='caf.Grading'), - ), - ] diff --git a/ctrack/caf/migrations/0009_grading_type.py b/ctrack/caf/migrations/0009_grading_type.py deleted file mode 100644 index 3c63218..0000000 --- a/ctrack/caf/migrations/0009_grading_type.py +++ /dev/null @@ -1,19 +0,0 @@ -# Generated by Django 2.2.9 on 2020-02-25 07:24 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('caf', '0008_auto_20200225_0722'), - ] - - operations = [ - migrations.AddField( - model_name='grading', - name='type', - field=models.CharField(choices=[('CONFIDENCE', 'Confidence'), ('QUALITY', 'Quality'), ('MISC', 'Misc')], default='MISC', help_text='Type of grading', max_length=20), - preserve_default=False, - ), - ] diff --git a/ctrack/caf/migrations/0010_auto_20200225_0747.py b/ctrack/caf/migrations/0010_auto_20200225_0747.py deleted file mode 100644 index 7104bb8..0000000 --- a/ctrack/caf/migrations/0010_auto_20200225_0747.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 2.2.9 on 2020-02-25 07:47 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('caf', '0009_grading_type'), - ] - - operations = [ - migrations.AlterField( - model_name='grading', - name='descriptor', - field=models.CharField(help_text='Q1, C1, etc', max_length=2), - ), - ] diff --git a/ctrack/caf/migrations/0011_auto_20200225_0830.py b/ctrack/caf/migrations/0011_auto_20200225_0830.py deleted file mode 100644 index 826b267..0000000 --- a/ctrack/caf/migrations/0011_auto_20200225_0830.py +++ /dev/null @@ -1,23 +0,0 @@ -# Generated by Django 2.2.9 on 2020-02-25 08:30 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('caf', '0010_auto_20200225_0747'), - ] - - operations = [ - migrations.RemoveField( - model_name='caf', - name='triage_grading', - ), - 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'), - ), - ] diff --git a/ctrack/caf/migrations/0012_auto_20200226_2202.py b/ctrack/caf/migrations/0012_auto_20200226_2202.py deleted file mode 100644 index 0dbfd17..0000000 --- a/ctrack/caf/migrations/0012_auto_20200226_2202.py +++ /dev/null @@ -1,17 +0,0 @@ -# Generated by Django 2.2.9 on 2020-02-26 22:02 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('caf', '0011_auto_20200225_0830'), - ] - - operations = [ - migrations.AlterModelOptions( - name='caffilestore', - options={}, - ), - ] diff --git a/ctrack/caf/migrations/0013_auto_20200227_0827.py b/ctrack/caf/migrations/0013_auto_20200227_0827.py deleted file mode 100644 index 6aab6b4..0000000 --- a/ctrack/caf/migrations/0013_auto_20200227_0827.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 2.2.9 on 2020-02-27 08:27 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('organisations', '0004_auto_20200220_1634'), - ('caf', '0012_auto_20200226_2202'), - ] - - operations = [ - migrations.RenameModel( - old_name='CAFFileStore', - new_name='FileStore', - ), - ] diff --git a/ctrack/caf/migrations/0014_auto_20200228_2215.py b/ctrack/caf/migrations/0014_auto_20200228_2215.py deleted file mode 100644 index f1d8c7a..0000000 --- a/ctrack/caf/migrations/0014_auto_20200228_2215.py +++ /dev/null @@ -1,19 +0,0 @@ -# Generated by Django 2.2.9 on 2020-02-28 22:15 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('caf', '0013_auto_20200227_0827'), - ] - - operations = [ - migrations.AlterField( - model_name='essentialservice', - name='caf', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='caf.CAF'), - ), - ] diff --git a/ctrack/caf/migrations/0015_auto_20200303_0727.py b/ctrack/caf/migrations/0015_auto_20200303_0727.py deleted file mode 100644 index d0f3e8a..0000000 --- a/ctrack/caf/migrations/0015_auto_20200303_0727.py +++ /dev/null @@ -1,19 +0,0 @@ -# Generated by Django 2.2.9 on 2020-03-03 07:27 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('caf', '0014_auto_20200228_2215'), - ] - - operations = [ - migrations.AlterField( - model_name='essentialservice', - name='caf', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='essential_services', to='caf.CAF'), - ), - ] diff --git a/ctrack/caf/migrations/0016_auto_20200303_0825.py b/ctrack/caf/migrations/0016_auto_20200303_0825.py deleted file mode 100644 index 49c6c4e..0000000 --- a/ctrack/caf/migrations/0016_auto_20200303_0825.py +++ /dev/null @@ -1,36 +0,0 @@ -# Generated by Django 2.2.9 on 2020-03-03 08:25 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('organisations', '0005_auto_20200303_0727'), - ('caf', '0015_auto_20200303_0727'), - ] - - operations = [ - migrations.AddField( - model_name='caf', - name='comments', - field=models.TextField(default='No comment', max_length=1000), - preserve_default=False, - ), - migrations.AddField( - model_name='caf', - name='triage_review_date', - field=models.DateField(blank=True, null=True), - ), - 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='caf', - name='version', - field=models.CharField(blank=True, max_length=10, null=True), - ), - ] diff --git a/ctrack/caf/migrations/0017_auto_20200304_1925.py b/ctrack/caf/migrations/0017_auto_20200304_1925.py deleted file mode 100644 index 198558a..0000000 --- a/ctrack/caf/migrations/0017_auto_20200304_1925.py +++ /dev/null @@ -1,32 +0,0 @@ -# Generated by Django 2.2.9 on 2020-03-04 19:25 - -import ctrack.caf.models -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('organisations', '0005_auto_20200303_0727'), - ('caf', '0016_auto_20200303_0825'), - ] - - operations = [ - migrations.CreateModel( - 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)), - ('caf', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='applicable_systems', to='caf.CAF')), - ('organisation', models.ForeignKey(on_delete=models.SET(ctrack.caf.models.ApplicableSystem.get_sentinel_org), to='organisations.Organisation')), - ], - options={ - 'verbose_name': 'Applicable System', - }, - ), - migrations.DeleteModel( - name='EssentialService', - ), - ] diff --git a/ctrack/caf/migrations/0018_remove_caf_owner.py b/ctrack/caf/migrations/0018_remove_caf_owner.py deleted file mode 100644 index 02d28c7..0000000 --- a/ctrack/caf/migrations/0018_remove_caf_owner.py +++ /dev/null @@ -1,17 +0,0 @@ -# Generated by Django 2.2.9 on 2020-03-04 19:47 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('caf', '0017_auto_20200304_1925'), - ] - - operations = [ - migrations.RemoveField( - model_name='caf', - name='owner', - ), - ] diff --git a/ctrack/contrib/sites/migrations/0001_initial.py b/ctrack/contrib/sites/migrations/0001_initial.py index a41c918..748e953 100644 --- a/ctrack/contrib/sites/migrations/0001_initial.py +++ b/ctrack/contrib/sites/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 2.2.9 on 2020-02-20 14:34 +# Generated by Django 2.2.9 on 2020-04-03 14:07 import django.contrib.sites.models from django.db import migrations, models diff --git a/ctrack/organisations/management/commands/populate_db.py b/ctrack/organisations/management/commands/populate_db.py index e5f76ac..bb963e3 100644 --- a/ctrack/organisations/management/commands/populate_db.py +++ b/ctrack/organisations/management/commands/populate_db.py @@ -4,8 +4,8 @@ from random import randint, choice from django.core.management import BaseCommand from django.core.management import CommandParser -from ctrack.assessments.models import CAFSelfAssessment, CAFObjective, CAFPrinciple, CAFContributingOutcome, \ - CAFSelfAssessmentOutcomeScore +from ctrack.assessments.models import CAFAssessment, CAFObjective, CAFPrinciple, CAFContributingOutcome, \ + CAFAssessmentOutcomeScore from ctrack.caf.models import CAF from ctrack.caf.tests.factories import ( GradingFactory, @@ -571,17 +571,17 @@ class Command(BaseCommand): _caf2 = CAF.objects.get(pk=1) _completer = Person.objects.get(pk=1) - caf_self_assessment = CAFSelfAssessment.objects.create( + caf_assessment = CAFAssessment.objects.create( caf_id=_caf2.id, completer_id=_completer.id, comments="Random Comments" ) # TODO Need to create as many of these as there are ContributingOutcomes # Create a single CAFSelfAssessmentOutcomeScore for c in cos: - CAFSelfAssessmentOutcomeScore.objects.create( - caf_self_assessment_id=caf_self_assessment.id, + CAFAssessmentOutcomeScore.objects.create( + caf_assessment_id=caf_assessment.id, caf_contributing_outcome_id=c.id, - self_assessment_score=random.choice(["Achieved", "Partially Achieved", "Not Achieved"]), + assessment_score=random.choice(["Achieved", "Partially Achieved", "Not Achieved"]), baseline_assessment_score=random.choice(["Achieved", "Partially Achieved", "Not Achieved"]) ) diff --git a/ctrack/organisations/migrations/0001_initial.py b/ctrack/organisations/migrations/0001_initial.py index c922874..a420fa1 100644 --- a/ctrack/organisations/migrations/0001_initial.py +++ b/ctrack/organisations/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 2.2.9 on 2020-02-20 14:34 +# Generated by Django 2.2.9 on 2020-04-03 14:07 from django.db import migrations, models import django.db.models.deletion @@ -50,7 +50,8 @@ 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'])), - ('designation_type', models.IntegerField(choices=[(1, 'Automatic'), (2, 'Reserve Power')], default=1)), + ('oes', models.BooleanField()), + ('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)), diff --git a/ctrack/organisations/migrations/0002_auto_20200220_1434.py b/ctrack/organisations/migrations/0002_auto_20200403_1407.py index 6d12071..d9f3aed 100644 --- a/ctrack/organisations/migrations/0002_auto_20200220_1434.py +++ b/ctrack/organisations/migrations/0002_auto_20200403_1407.py @@ -1,5 +1,6 @@ -# Generated by Django 2.2.9 on 2020-02-20 14:34 +# 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 @@ -18,7 +19,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='person', name='updated_by', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), + field=models.ForeignKey(on_delete=models.SET(ctrack.organisations.models.Person.get_sentinel_user), to=settings.AUTH_USER_MODEL), ), migrations.AddField( model_name='organisation', @@ -28,7 +29,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='organisation', name='updated_by', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), + field=models.ForeignKey(on_delete=models.SET(ctrack.organisations.models.Organisation.get_sentinel_user), to=settings.AUTH_USER_MODEL), ), migrations.AddField( model_name='address', diff --git a/ctrack/organisations/migrations/0003_auto_20200220_1625.py b/ctrack/organisations/migrations/0003_auto_20200220_1625.py deleted file mode 100644 index 65f4478..0000000 --- a/ctrack/organisations/migrations/0003_auto_20200220_1625.py +++ /dev/null @@ -1,20 +0,0 @@ -# Generated by Django 2.2.9 on 2020-02-20 16:25 - -import ctrack.organisations.models -from django.conf import settings -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('organisations', '0002_auto_20200220_1434'), - ] - - operations = [ - migrations.AlterField( - 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), - ), - ] diff --git a/ctrack/organisations/migrations/0004_auto_20200220_1634.py b/ctrack/organisations/migrations/0004_auto_20200220_1634.py deleted file mode 100644 index 297931e..0000000 --- a/ctrack/organisations/migrations/0004_auto_20200220_1634.py +++ /dev/null @@ -1,20 +0,0 @@ -# Generated by Django 2.2.9 on 2020-02-20 16:34 - -import ctrack.organisations.models -from django.conf import settings -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('organisations', '0003_auto_20200220_1625'), - ] - - operations = [ - migrations.AlterField( - 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), - ), - ] diff --git a/ctrack/organisations/migrations/0005_auto_20200303_0727.py b/ctrack/organisations/migrations/0005_auto_20200303_0727.py deleted file mode 100644 index 8db8302..0000000 --- a/ctrack/organisations/migrations/0005_auto_20200303_0727.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 2.2.9 on 2020-03-03 07:27 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('organisations', '0004_auto_20200220_1634'), - ] - - operations = [ - migrations.AlterField( - model_name='organisation', - name='designation_type', - field=models.IntegerField(choices=[(1, 'Automatic'), (2, 'Reserve Power'), (3, 'NA')], default=1), - ), - ] diff --git a/ctrack/organisations/migrations/0006_organisation_oes.py b/ctrack/organisations/migrations/0006_organisation_oes.py deleted file mode 100644 index 17edfb5..0000000 --- a/ctrack/organisations/migrations/0006_organisation_oes.py +++ /dev/null @@ -1,19 +0,0 @@ -# Generated by Django 2.2.9 on 2020-03-11 16:56 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('organisations', '0005_auto_20200303_0727'), - ] - - operations = [ - migrations.AddField( - model_name='organisation', - name='oes', - field=models.BooleanField(default=True), - preserve_default=False, - ), - ] diff --git a/ctrack/register/migrations/0001_initial.py b/ctrack/register/migrations/0001_initial.py index 2ac7241..7db1237 100644 --- a/ctrack/register/migrations/0001_initial.py +++ b/ctrack/register/migrations/0001_initial.py @@ -1,7 +1,5 @@ -# Generated by Django 2.2.9 on 2020-02-21 15:20 +# Generated by Django 2.2.9 on 2020-04-03 14:07 -import ctrack.register.models -from django.conf import settings from django.db import migrations, models import django.db.models.deletion @@ -11,9 +9,8 @@ class Migration(migrations.Migration): initial = True dependencies = [ - ('organisations', '0004_auto_20200220_1634'), - migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ('caf', '0002_auto_20200220_1434'), + ('caf', '0002_auto_20200403_1407'), + ('organisations', '0001_initial'), ] operations = [ @@ -23,23 +20,24 @@ class Migration(migrations.Migration): ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('descriptor', models.CharField(max_length=50)), ('enforcement_instrument', models.BooleanField(default=False)), - ('regulation_reference', models.CharField(blank=True, max_length=100)), - ('comments', models.TextField(max_length=1000)), + ('regulation_reference', models.CharField(blank=True, max_length=100, null=True)), + ('comments', models.TextField(blank=True, max_length=1000, null=True)), ], ), migrations.CreateModel( name='EngagementEvent', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('short_description', models.CharField(help_text='Short description of the event', max_length=50)), ('date', models.DateTimeField()), - ('end_date', models.DateTimeField(blank=True)), - ('document_link', models.URLField(max_length=1000)), - ('response_date_requested', models.DateField()), - ('response_received', models.DateField()), + ('end_date', models.DateTimeField(blank=True, null=True)), + ('document_link', models.URLField(blank=True, max_length=1000, null=True)), + ('response_date_requested', models.DateField(blank=True, null=True)), + ('response_received', models.DateField(blank=True, null=True)), + ('comments', models.TextField(blank=True, max_length=1000, null=True)), ('participants', models.ManyToManyField(to='organisations.Person')), - ('related_caf', models.ForeignKey(blank=True, on_delete=django.db.models.deletion.CASCADE, to='caf.CAF')), + ('related_caf', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='caf.CAF')), ('type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='register.EngagementType')), - ('user', models.ForeignKey(on_delete=models.SET(ctrack.register.models.EngagementEvent.get_sentinel_user), to=settings.AUTH_USER_MODEL)), ], ), ] diff --git a/ctrack/register/migrations/0002_auto_20200221_1527.py b/ctrack/register/migrations/0002_auto_20200221_1527.py deleted file mode 100644 index ad82341..0000000 --- a/ctrack/register/migrations/0002_auto_20200221_1527.py +++ /dev/null @@ -1,49 +0,0 @@ -# Generated by Django 2.2.9 on 2020-02-21 15:27 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('register', '0001_initial'), - ] - - operations = [ - migrations.AlterField( - model_name='engagementevent', - name='document_link', - field=models.URLField(blank=True, max_length=1000, null=True), - ), - migrations.AlterField( - model_name='engagementevent', - name='end_date', - field=models.DateTimeField(blank=True, null=True), - ), - migrations.AlterField( - model_name='engagementevent', - name='related_caf', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='caf.CAF'), - ), - migrations.AlterField( - model_name='engagementevent', - name='response_date_requested', - field=models.DateField(blank=True, null=True), - ), - migrations.AlterField( - model_name='engagementevent', - name='response_received', - field=models.DateField(blank=True, null=True), - ), - migrations.AlterField( - model_name='engagementtype', - name='comments', - field=models.TextField(blank=True, max_length=1000, null=True), - ), - migrations.AlterField( - model_name='engagementtype', - name='regulation_reference', - field=models.CharField(blank=True, max_length=100, null=True), - ), - ] diff --git a/ctrack/register/migrations/0002_engagementevent_user.py b/ctrack/register/migrations/0002_engagementevent_user.py new file mode 100644 index 0000000..59c93d6 --- /dev/null +++ b/ctrack/register/migrations/0002_engagementevent_user.py @@ -0,0 +1,23 @@ +# Generated by Django 2.2.9 on 2020-04-03 14:07 + +import ctrack.register.models +from django.conf import settings +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('register', '0001_initial'), + ] + + operations = [ + migrations.AddField( + model_name='engagementevent', + name='user', + field=models.ForeignKey(on_delete=models.SET(ctrack.register.models.EngagementEvent.get_sentinel_user), to=settings.AUTH_USER_MODEL), + ), + ] diff --git a/ctrack/register/migrations/0003_engagementevent_short_description.py b/ctrack/register/migrations/0003_engagementevent_short_description.py deleted file mode 100644 index dc976f9..0000000 --- a/ctrack/register/migrations/0003_engagementevent_short_description.py +++ /dev/null @@ -1,19 +0,0 @@ -# Generated by Django 2.2.9 on 2020-02-21 15:30 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('register', '0002_auto_20200221_1527'), - ] - - operations = [ - migrations.AddField( - model_name='engagementevent', - name='short_description', - field=models.CharField(default='NA', help_text='Short description of the event', max_length=50), - preserve_default=False, - ), - ] diff --git a/ctrack/register/migrations/0004_engagementevent_comments.py b/ctrack/register/migrations/0004_engagementevent_comments.py deleted file mode 100644 index 3379b03..0000000 --- a/ctrack/register/migrations/0004_engagementevent_comments.py +++ /dev/null @@ -1,19 +0,0 @@ -# Generated by Django 2.2.9 on 2020-03-03 09:06 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('register', '0003_engagementevent_short_description'), - ] - - operations = [ - migrations.AddField( - model_name='engagementevent', - name='comments', - field=models.TextField(default='No comment', max_length=1000), - preserve_default=False, - ), - ] diff --git a/ctrack/register/migrations/0005_auto_20200303_0909.py b/ctrack/register/migrations/0005_auto_20200303_0909.py deleted file mode 100644 index 94551a5..0000000 --- a/ctrack/register/migrations/0005_auto_20200303_0909.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 2.2.9 on 2020-03-03 09:09 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('register', '0004_engagementevent_comments'), - ] - - operations = [ - migrations.AlterField( - model_name='engagementevent', - name='comments', - field=models.TextField(blank=True, max_length=1000, null=True), - ), - ] diff --git a/ctrack/users/migrations/0001_initial.py b/ctrack/users/migrations/0001_initial.py index 265c3d4..2f760c2 100644 --- a/ctrack/users/migrations/0001_initial.py +++ b/ctrack/users/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 2.2.9 on 2020-02-20 14:34 +# Generated by Django 2.2.9 on 2020-04-03 14:07 import django.contrib.auth.models import django.contrib.auth.validators diff --git a/utility/resetting_migrations.md b/utility/resetting_migrations.md new file mode 100644 index 0000000..e3776bc --- /dev/null +++ b/utility/resetting_migrations.md @@ -0,0 +1,34 @@ +# Resetting Migrations + +When you absolutely balls it up and you want to start again, +Make sure you do the following: + +You first need to remove those pesky migrations from your thing: +```bash +find . -path "*/migrations/*.py" -not -name "__init__.py" -delete +find . -path "*/migrations/*.pyc" -delete +``` + +Then you need to eradicate that old database and create a new one! +In PostgreSQL, that's easy: +```bash +sudo -u postgres psql +DROP DATABASE <database_name> +CREATE DATBASE <database_name> +\q +``` + +Now, to recreate those migrations... +Here is what you do: + +```bash +python manage.py makemigrations +python manage.py migrate +``` + +If `allauth` social accounts gives you problems - and it can: +You need to except this app from your application momentarily... +Comment it out of your settings. +Run your migrations again. + +You are good, my friend. |