summaryrefslogtreecommitdiffstats
path: root/engagements/views.py
diff options
context:
space:
mode:
Diffstat (limited to 'engagements/views.py')
-rw-r--r--engagements/views.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/engagements/views.py b/engagements/views.py
index e66d679..2257a98 100644
--- a/engagements/views.py
+++ b/engagements/views.py
@@ -4,7 +4,8 @@ from django.db.models import Q
from django.http import HttpResponse
from django.shortcuts import get_object_or_404, redirect, render
from django.template.loader import render_to_string
-from django.views.generic import ListView
+from django.urls import reverse_lazy
+from django.views.generic import CreateView, ListView
from instruments.models import SubInstrument
@@ -14,13 +15,14 @@ from .forms import (
EngagementEffortRegulationCreateForm,
EngagementEffortReportingCreateForm,
EngagementEffortTravelCreateForm,
+ EngagementStrategyCreateForm,
)
-from .models import Engagement, EngagementEffort, EngagementType, Organisation
+from .models import Engagement, EngagementEffort, EngagementStrategy, EngagementType, Organisation
def effort_detail(request, effort_id):
effort = get_object_or_404(EngagementEffort, id=effort_id)
- html = render_to_string('engagements/snippets/effort_detail.html', {'effort': effort})
+ html = render_to_string("engagements/snippets/effort_detail.html", {"effort": effort})
return HttpResponse(html)
@@ -48,7 +50,7 @@ def htmx_effort_planned(request, effid):
else:
effort.is_planned = True
effort.save()
- return render(request, "engagements/snippets/effort_summary_panel.html", {"e" : effort})
+ return render(request, "engagements/snippets/effort_summary_panel.html", {"e": effort})
@login_required
@@ -194,3 +196,10 @@ def engagement_create(request, slug, reg=None):
"engagements/engagement_form.html",
{"form": form, "title": "Add New Engagement"},
)
+
+
+class CreateEngagementStrategy(LoginRequiredMixin, CreateView):
+ model = EngagementStrategy
+ form_class = EngagementStrategyCreateForm
+ template_name = "engagements/engagement_strategy_form.html"
+ success_url = reverse_lazy("engagements:home")