summaryrefslogtreecommitdiffstats
path: root/engagements/views.py
diff options
context:
space:
mode:
Diffstat (limited to 'engagements/views.py')
-rw-r--r--engagements/views.py24
1 files changed, 23 insertions, 1 deletions
diff --git a/engagements/views.py b/engagements/views.py
index 7146b67..55ddecd 100644
--- a/engagements/views.py
+++ b/engagements/views.py
@@ -1,7 +1,7 @@
from django.contrib.auth.decorators import login_required
from django.contrib.auth.mixins import LoginRequiredMixin
from django.db.models import Q
-from django.http import HttpResponse
+from django.http import HttpResponse, HttpResponseBadRequest
from django.shortcuts import get_object_or_404, redirect, render
from django.template.loader import render_to_string
from django.urls import reverse_lazy
@@ -16,6 +16,7 @@ from .forms import (
EngagementEffortReportingCreateForm,
EngagementEffortTravelCreateForm,
EngagementStrategyCreateForm,
+ AssessmentCreateForm,
)
from .models import Engagement, EngagementEffort, EngagementStrategy, EngagementType, Organisation
from .utils import duration_formatter
@@ -209,3 +210,24 @@ class CreateEngagementStrategy(LoginRequiredMixin, CreateView):
class OrgListView(LoginRequiredMixin, ListView):
model = Organisation
+
+
+@login_required
+def create_assessment(request):
+ if request.method == "POST":
+ pass
+ else:
+ eng_type_id = request.GET.get("eng_type_id", None)
+ entity_id = request.GET.get("entity_id", None)
+ if not eng_type_id:
+ return HttpResponseBadRequest("You must provide an engagement_type id")
+ if not entity_id:
+ return HttpResponseBadRequest("You must provide an entity id")
+ eng_type = EngagementType.objects.get(id=eng_type_id)
+ entity = Organisation.objects.get(id=entity_id)
+ form = AssessmentCreateForm()
+ return render(
+ request,
+ "engagements/eng_forms/assessment_create.html",
+ {"form": form},
+ )