diff options
author | Matthew Lemon <matt@matthewlemon.com> | 2020-08-28 11:03:49 +0100 |
---|---|---|
committer | Matthew Lemon <matt@matthewlemon.com> | 2020-08-28 11:03:49 +0100 |
commit | 5f4e80b9c5c39e6eebb86edce20ffe107c03aa3e (patch) | |
tree | 8f56e45f7660ee1754cf7a8d4170fdad1ac7719b | |
parent | 0b1c397af82abd41e4379bd1f1eab490fe22db38 (diff) |
tracked down the bastard
-rw-r--r-- | config/settings/base.py | 1 | ||||
-rw-r--r-- | ctrack/assessments/models.py | 45 | ||||
-rw-r--r-- | ctrack/caf/templates/caf/caf_detail.html | 2 | ||||
-rw-r--r-- | ctrack/caf/views.py | 2 | ||||
-rw-r--r-- | ctrack/core/utils.py | 1 |
5 files changed, 36 insertions, 15 deletions
diff --git a/config/settings/base.py b/config/settings/base.py index c1702d7..c699798 100644 --- a/config/settings/base.py +++ b/config/settings/base.py @@ -68,6 +68,7 @@ DJANGO_APPS = [ "django.contrib.sessions", "django.contrib.sites", "django.contrib.messages", + "django_pdb", ## this needs to be before django.contrib.staticfiles according to its docs "django.contrib.staticfiles", # "django.contrib.humanize", # Handy template tags "django.contrib.admin", diff --git a/ctrack/assessments/models.py b/ctrack/assessments/models.py index d3cd4dd..89d83b8 100644 --- a/ctrack/assessments/models.py +++ b/ctrack/assessments/models.py @@ -13,16 +13,17 @@ class CAFAssessment(models.Model): verbose_name = "CAF Assessment" def get_title(self): - return f"CAF Assessment for {self.caf.applicable_systems.first().organisation.name} - version {self.caf.version}" + return f"CAF Assessment for {self.caf.organisation.name} - version {self.caf.version}" def __str__(self): - return f"CAF Assessment for {self.caf.applicable_systems.first().organisation.name} - version {self.caf.version}" + return f"CAF Assessment for {self.caf.organisation.name} - version {self.caf.version}" class CAFObjective(models.Model): """ One of 4 as set out in the framework... """ + name = models.CharField(max_length=100, help_text="e.g. Managing Risk") description = models.TextField(max_length=500) order_id = models.IntegerField() @@ -38,6 +39,7 @@ class CAFPrinciple(models.Model): """ One of 14 as set out in the framework. """ + caf_objective = models.ForeignKey(CAFObjective, on_delete=models.CASCADE) designation = models.CharField(max_length=5, help_text="e.g. A1, B3, etc") title = models.CharField(max_length=50) @@ -55,6 +57,7 @@ class CAFContributingOutcome(models.Model): """ One of the 39 as set out in the framework. """ + designation = models.CharField(max_length=5, help_text="e.g. A1.a, B3.c, etc") name = models.CharField(max_length=100, help_text="e.g. Board Direction") description = models.TextField(max_length=1000) @@ -73,20 +76,32 @@ 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. """ + ASSESSMENT_SCORE = ( ("Achieved", "Achieved"), ("Partially Achieved", "Partially Achieved"), ("Not Achieved", "Not Achieved"), ) - 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") - 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") + 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", + ) + 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 Assessment Outcome Score" @@ -98,7 +113,9 @@ class CAFAssessmentOutcomeScore(models.Model): 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 + colour_hex = models.CharField( + max_length=8 + ) # CSS hex code or simple word descriptor def __str__(self): return f"{self.descriptor}" @@ -106,7 +123,9 @@ class AchievementLevel(models.Model): class IGP(models.Model): achievement_level = models.ForeignKey(AchievementLevel, on_delete=models.CASCADE) - contributing_outcome = models.ForeignKey(CAFContributingOutcome, on_delete=models.CASCADE) + contributing_outcome = models.ForeignKey( + CAFContributingOutcome, on_delete=models.CASCADE + ) descriptive_text = models.CharField(max_length=2000) class Meta: diff --git a/ctrack/caf/templates/caf/caf_detail.html b/ctrack/caf/templates/caf/caf_detail.html index fc2fcfd..fdd939e 100644 --- a/ctrack/caf/templates/caf/caf_detail.html +++ b/ctrack/caf/templates/caf/caf_detail.html @@ -72,7 +72,7 @@ <tr> <td><a href="{% url "caf:ass_detail" system.id %}">{{ system.name }}</a></td> <td>{{ system.function }}<br> - <a href="{% url "caf:detail" system.caf.pk %}" class="small"> + <a href="{% url "caf:detail" system.pk %}" class="small"> {{ system.caf }} </a> <span class="text-muted"> | <a href="#" class="small">Edit System</a></span> </td> diff --git a/ctrack/caf/views.py b/ctrack/caf/views.py index 4eacd08..4dbde02 100644 --- a/ctrack/caf/views.py +++ b/ctrack/caf/views.py @@ -37,7 +37,7 @@ def caf_detail_view(request, pk): "object": caf, "assessments_and_scores": _scrs, "organisation": caf.organisation, - "systems": caf.systems, + "systems": caf.systems.all(), } return render(request, "caf/caf_detail.html", context) diff --git a/ctrack/core/utils.py b/ctrack/core/utils.py index af01549..5382a84 100644 --- a/ctrack/core/utils.py +++ b/ctrack/core/utils.py @@ -687,6 +687,7 @@ def populate_db(**kwargs): _caf2 = CAF.objects.get(pk=1) _completer = Person.objects.get(pk=1) + breakpoint() caf_assessment = CAFAssessment.objects.create( caf_id=_caf2.id, completer_id=_completer.id, comments="Random Comments" ) |