diff options
Diffstat (limited to 'ctrack/assessments')
-rw-r--r-- | ctrack/assessments/admin.py | 12 | ||||
-rw-r--r-- | ctrack/assessments/migrations/0004_achievementlevel_igp.py | 32 | ||||
-rw-r--r-- | ctrack/assessments/migrations/0005_auto_20200512_1438.py | 27 | ||||
-rw-r--r-- | ctrack/assessments/models.py | 21 | ||||
-rw-r--r-- | ctrack/assessments/tests/factories.py | 18 |
5 files changed, 102 insertions, 8 deletions
diff --git a/ctrack/assessments/admin.py b/ctrack/assessments/admin.py index 10c19d0..869b542 100644 --- a/ctrack/assessments/admin.py +++ b/ctrack/assessments/admin.py @@ -1,7 +1,7 @@ from django.contrib import admin from ctrack.assessments.models import CAFAssessment, CAFObjective, CAFPrinciple, CAFContributingOutcome, \ - CAFAssessmentOutcomeScore + CAFAssessmentOutcomeScore, IGP, AchievementLevel class CAFAssessmentAdmin(admin.ModelAdmin): @@ -24,8 +24,18 @@ class CAFAssessmentOutcomeScoreAdmin(admin.ModelAdmin): model = CAFAssessmentOutcomeScore +class IGPAdmin(admin.ModelAdmin): + model = IGP + + +class AchievementLevelAdmin(admin.ModelAdmin): + model = AchievementLevel + + admin.site.register(CAFAssessment, CAFAssessmentAdmin) admin.site.register(CAFObjective, CAFObjectiveAdmin) admin.site.register(CAFPrinciple, CAFPrincipleAdmin) admin.site.register(CAFContributingOutcome, CAFContributingOutcomeAdmin) admin.site.register(CAFAssessmentOutcomeScore, CAFAssessmentOutcomeScoreAdmin) +admin.site.register(IGP, IGPAdmin) +admin.site.register(AchievementLevel, AchievementLevelAdmin) diff --git a/ctrack/assessments/migrations/0004_achievementlevel_igp.py b/ctrack/assessments/migrations/0004_achievementlevel_igp.py new file mode 100644 index 0000000..581a115 --- /dev/null +++ b/ctrack/assessments/migrations/0004_achievementlevel_igp.py @@ -0,0 +1,32 @@ +# 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 new file mode 100644 index 0000000..31a741a --- /dev/null +++ b/ctrack/assessments/migrations/0005_auto_20200512_1438.py @@ -0,0 +1,27 @@ +# 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/assessments/models.py b/ctrack/assessments/models.py index db8c8e1..d3cd4dd 100644 --- a/ctrack/assessments/models.py +++ b/ctrack/assessments/models.py @@ -5,9 +5,6 @@ from ctrack.organisations.models import Person class CAFAssessment(models.Model): - """ - These are carried out by an OES as result in, or are associated with a CAF. - """ caf = models.ForeignKey(CAF, on_delete=models.CASCADE) completer = models.ForeignKey(Person, on_delete=models.CASCADE) comments = models.TextField(max_length=500) @@ -96,3 +93,21 @@ class CAFAssessmentOutcomeScore(models.Model): def __str__(self): return f"{self.caf_contributing_outcome} | {self.caf_assessment} | {self.assessment_score}" + + +class AchievementLevel(models.Model): + descriptor = models.CharField(max_length=50) + colour_description = models.CharField(max_length=100) + colour_hex = models.CharField(max_length=8) # CSS hex code or simple word descriptor + + def __str__(self): + return f"{self.descriptor}" + + +class IGP(models.Model): + achievement_level = models.ForeignKey(AchievementLevel, on_delete=models.CASCADE) + contributing_outcome = models.ForeignKey(CAFContributingOutcome, on_delete=models.CASCADE) + descriptive_text = models.CharField(max_length=2000) + + class Meta: + verbose_name = "IGP" diff --git a/ctrack/assessments/tests/factories.py b/ctrack/assessments/tests/factories.py index c8e26ec..21b2286 100644 --- a/ctrack/assessments/tests/factories.py +++ b/ctrack/assessments/tests/factories.py @@ -1,7 +1,17 @@ -# Factories for populating the CAF assessment data - import factory +from factory import Faker + +from ctrack.assessments.models import AchievementLevel + + +class AchievementLevelFactory(factory.DjangoModelFactory): + descriptor = Faker("text", max_nb_chars=30, ext_word_list=None) + colour_description = Faker("text", max_nb_chars=30, ext_word_list=None) + colour_hex = Faker("text", max_nb_chars=30, ext_word_list=None) + + class Meta: + model = AchievementLevel -# class CAFSelfAssessmentFactory(factory.DjangoModelFactory): -# caf = factory.SubFactory("ctrack.caf.tests.factories.CAF") +class IGPFactory(factory.DjangoModelFactory): + achievement_level = factory.SubFactory(AchievementLevelFactory) |