diff options
author | Matthew Lemon <y@yulqen.org> | 2024-09-10 15:36:13 +0100 |
---|---|---|
committer | Matthew Lemon <y@yulqen.org> | 2024-09-10 15:36:13 +0100 |
commit | 15520388a725dd9763e80ad617f31aea3b2ddb67 (patch) | |
tree | d28670b8abfc405f6e3541805e59b588735696f3 /engagements/views.py | |
parent | b87f2e3410cf3445a4eeb1ca16d04cc7de71c330 (diff) |
wip: testing the view containing the ES create form
Diffstat (limited to 'engagements/views.py')
-rw-r--r-- | engagements/views.py | 17 |
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") |