aboutsummaryrefslogtreecommitdiffstats
path: root/ctrack/caf/views.py
diff options
context:
space:
mode:
Diffstat (limited to 'ctrack/caf/views.py')
-rw-r--r--ctrack/caf/views.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/ctrack/caf/views.py b/ctrack/caf/views.py
index 258774e..480e305 100644
--- a/ctrack/caf/views.py
+++ b/ctrack/caf/views.py
@@ -36,8 +36,8 @@ def caf_detail_view(request, pk):
context = {
"object": caf,
"assessments_and_scores": _scrs,
- "organisation": ApplicableSystem.objects.filter(caf=caf).first().organisation,
- "systems": caf.applicable_systems.all(),
+ "organisation": caf.organisation,
+ "systems": caf.systems.all(),
}
return render(request, "caf/caf_detail.html", context)
@@ -107,20 +107,22 @@ class ApplicableSystemCreateFromOrg(
ass = ApplicableSystem.objects.create(
name=form.cleaned_data["name"],
function=form.cleaned_data["function"],
- organisation=form.cleaned_data["organisation"],
- caf=form.cleaned_data["caf"],
+ # organisation=form.cleaned_data["organisation"],
+ # caf=form.cleaned_data["caf"],
)
+ es = form.cleaned_data["essential_service"]
+ es.systems.add(ass)
return super().form_valid(form)
def get_form_kwargs(self):
kwargs = super().get_form_kwargs()
org = Organisation.objects.get(slug=self.kwargs["slug"])
- asses = org.applicablesystem_set.all()
- org_cafs = {ass.caf for ass in asses}
+ asses = org.applicable_systems()
+ # org_cafs = org.caf_set.all()
kwargs["org_id"] = org.id
kwargs["slug"] = org.slug
kwargs["org_name"] = org.name
- kwargs["org_cafs"] = list(org_cafs)
+ # kwargs["org_cafs"] = list(org_cafs)
return kwargs
def get_success_url(self):