diff options
-rw-r--r-- | ctrack/assessments/migrations/0002_auto_20200315_1617.py | 38 | ||||
-rw-r--r-- | ctrack/assessments/models.py | 5 | ||||
-rw-r--r-- | ctrack/organisations/management/commands/populate_db.py | 14 | ||||
-rw-r--r-- | utility/truncate_script.sql | 5 |
4 files changed, 59 insertions, 3 deletions
diff --git a/ctrack/assessments/migrations/0002_auto_20200315_1617.py b/ctrack/assessments/migrations/0002_auto_20200315_1617.py new file mode 100644 index 0000000..4acd7bb --- /dev/null +++ b/ctrack/assessments/migrations/0002_auto_20200315_1617.py @@ -0,0 +1,38 @@ +# 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/models.py b/ctrack/assessments/models.py index 35484a8..84e8607 100644 --- a/ctrack/assessments/models.py +++ b/ctrack/assessments/models.py @@ -22,13 +22,16 @@ class CAFObjective(models.Model): """ One of 4 as set out in the framework... """ - name = models.CharField(max_length=20, help_text="e.g. Managing Risk") + name = models.CharField(max_length=100, help_text="e.g. Managing Risk") description = models.TextField(max_length=500) order_id = models.IntegerField() class Meta: verbose_name = "CAF Objective" + def __str__(self): + return self.name + class CAFPrinciple(models.Model): """ diff --git a/ctrack/organisations/management/commands/populate_db.py b/ctrack/organisations/management/commands/populate_db.py index 80ea5d0..d7f9bc4 100644 --- a/ctrack/organisations/management/commands/populate_db.py +++ b/ctrack/organisations/management/commands/populate_db.py @@ -4,7 +4,7 @@ from random import randint, choice from django.core.management import BaseCommand from django.core.management import CommandParser -from ctrack.assessments.models import CAFSelfAssessment +from ctrack.assessments.models import CAFSelfAssessment, CAFObjective from ctrack.caf.models import CAF from ctrack.caf.tests.factories import ( GradingFactory, @@ -180,7 +180,18 @@ class Command(BaseCommand): caf_id=_caf2.id, completer_id=_completer.id, comments="Random Comments" ) + # We want to simulate 4 CAF Objectives + c_obj1 = CAFObjective.objects.create(name="Objective A: Major Issue A", + description="An important objective to fix the world.", order_id=1) + c_obj2 = CAFObjective.objects.create(name="Objective B: Major Issue B", + description="An important objective to fix the world.", order_id=2) + c_obj3 = CAFObjective.objects.create(name="Objective C: Major Issue C", + description="An important objective to fix the world.", order_id=3) + c_obj4 = CAFObjective.objects.create(name="Objective D: Major Issue D", + description="An important objective to fix the world.", order_id=4) + # TODO - adapt this so that it records more than just Persons created + self.stdout.write( self.style.SUCCESS( f"Created {number} Person object[s]! Go forth and multiply." @@ -199,4 +210,3 @@ class Command(BaseCommand): ApplicableSystemFactory.create( name=random.choice(fnames), organisation=org, caf=caf, ) - diff --git a/utility/truncate_script.sql b/utility/truncate_script.sql index 2f72c9c..e444c01 100644 --- a/utility/truncate_script.sql +++ b/utility/truncate_script.sql @@ -12,4 +12,9 @@ TRUNCATE TABLE caf_grading RESTART IDENTITY CASCADE; TRUNCATE TABLE caf_caf RESTART IDENTITY CASCADE; TRUNCATE TABLE caf_documentfile RESTART IDENTITY CASCADE; TRUNCATE TABLE caf_applicablesystem RESTART IDENTITY CASCADE; +TRUNCATE TABLE assessments_cafcontributingoutcome RESTART IDENTITY CASCADE; +TRUNCATE TABLE assessments_cafobjective RESTART IDENTITY CASCADE; +TRUNCATE TABLE assessments_cafprinciple RESTART IDENTITY CASCADE; +TRUNCATE TABLE assessments_cafselfassessment RESTART IDENTITY CASCADE; +TRUNCATE TABLE assessments_cafselfassessmentoutcomescore RESTART IDENTITY CASCADE; DELETE FROM users_user WHERE username != 'mrlemon'; |