summaryrefslogtreecommitdiffstats
path: root/engagements/views.py
diff options
context:
space:
mode:
Diffstat (limited to 'engagements/views.py')
-rw-r--r--engagements/views.py20
1 files changed, 8 insertions, 12 deletions
diff --git a/engagements/views.py b/engagements/views.py
index 55ddecd..2e40af8 100644
--- a/engagements/views.py
+++ b/engagements/views.py
@@ -213,21 +213,17 @@ class OrgListView(LoginRequiredMixin, ListView):
@login_required
-def create_assessment(request):
+def create_assessment(request, org):
if request.method == "POST":
- pass
+ form = AssessmentCreateForm(request.POST, org=org)
+ if form.is_valid():
+ form.save()
+ return redirect("engagements:home")
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()
+ form = AssessmentCreateForm(org=org)
+ org = Organisation.objects.get(slug=org)
return render(
request,
"engagements/eng_forms/assessment_create.html",
- {"form": form},
+ {"form": form, "org": org},
)