diff options
author | Matthew Lemon <y@yulqen.org> | 2024-09-05 15:01:16 +0100 |
---|---|---|
committer | Matthew Lemon <y@yulqen.org> | 2024-09-05 15:01:16 +0100 |
commit | d5833c7364060076ed4af460a6f020344ce74f21 (patch) | |
tree | f9b211d6db81ce76bd0b6e04b565a1de19e1e41d /engagements/views.py | |
parent | 257a559da9d653faf819d258a855f0bd2caec2db (diff) |
Improved engagement detail page layout, using htmx
Diffstat (limited to 'engagements/views.py')
-rw-r--r-- | engagements/views.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/engagements/views.py b/engagements/views.py index ae1abfd..a76a37d 100644 --- a/engagements/views.py +++ b/engagements/views.py @@ -1,11 +1,13 @@ from django.contrib.auth.decorators import login_required from django.contrib.auth.mixins import LoginRequiredMixin from django.db.models import Q -from django.shortcuts import get_object_or_404, redirect, render +from django.http import HttpResponse +from django.shortcuts import get_object_or_404 +from django.shortcuts import redirect, render +from django.template.loader import render_to_string from django.views.generic import ListView from instruments.models import SubInstrument - from .forms import ( EngagementCreateForm, EngagementEffortPlanningCreateForm, @@ -16,6 +18,12 @@ from .forms import ( from .models import Engagement, EngagementEffort, 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}) + return HttpResponse(html) + + class RegulatedEntitiesView(LoginRequiredMixin, ListView): context_object_name = "entities" queryset = Organisation.objects.filter(is_regulated_entity=True).order_by("name") |