aboutsummaryrefslogtreecommitdiffstats
path: root/ctrack/caf/views.py
diff options
context:
space:
mode:
authorMR Lemon <matt@matthewlemon>2020-04-19 17:17:51 +0100
committerMR Lemon <matt@matthewlemon>2020-04-19 17:17:51 +0100
commit9952f7a5fb3efc8abb657ab0cfaa7e898ec6606a (patch)
treec9e50aa97d6afa22f5ff2cad460697da3c5a897b /ctrack/caf/views.py
parentcf8e93936d98faf824029dcc18a7df4b07cc8cdd (diff)
setting up the new ApplicableSystemCreateFromOrg form... partial
Diffstat (limited to 'ctrack/caf/views.py')
-rw-r--r--ctrack/caf/views.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/ctrack/caf/views.py b/ctrack/caf/views.py
index 570700e..141c87e 100644
--- a/ctrack/caf/views.py
+++ b/ctrack/caf/views.py
@@ -4,8 +4,9 @@ from django.urls import reverse_lazy
from django.views.generic import ListView, DetailView, CreateView
from ctrack.assessments.models import CAFAssessmentOutcomeScore
-from ctrack.caf.forms import ApplicableSystemCreateForm
+from ctrack.caf.forms import ApplicableSystemCreateForm, ApplicableSystemCreateFromOrgForm
from ctrack.caf.models import ApplicableSystem, CAF
+from ctrack.organisations.models import Organisation
class ListCAF(LoginRequiredMixin, ListView):
@@ -53,12 +54,22 @@ class ApplicableSystemDetail(LoginRequiredMixin, DetailView):
template_name = "caf/applicablesystem_detail.html"
+class ApplicableSystemCreateFromOrg(LoginRequiredMixin, CreateView):
+ model = ApplicableSystem
+ form_class = ApplicableSystemCreateFromOrgForm
+ template_name = "caf/applicable_system_create_from_org.html"
+
+ def get_context_data(self, **kwargs):
+ org = Organisation.objects.get(slug=self.kwargs["slug"])
+ # TODO - now we have the organisation - we need to pass it to the form or store it in this class.
+ # We probably need to do return super().get_context_data(**kwargs) here to complete the func.
+ pass
+
+
class ApplicableSystemCreate(LoginRequiredMixin, CreateView):
form_class = ApplicableSystemCreateForm
model = ApplicableSystem
template_name = "caf/applicablesystem_create.html"
- success_url = reverse_lazy("caf:es_list")
def get_success_url(self) -> str:
return str(reverse_lazy("caf:ass_detail", args=[self.object.id]))
-