aboutsummaryrefslogtreecommitdiffstats
path: root/ctrack/organisations/views.py
diff options
context:
space:
mode:
authorMatthew Lemon <lemon@matthewlemon.com>2020-06-01 16:32:03 +0100
committerMatthew Lemon <lemon@matthewlemon.com>2020-06-01 16:32:03 +0100
commit37a5818eb76ad75055807d300d1cdd6fb5821b0a (patch)
tree4f2d842cce767c3aad6c5d6bf4a0e7e809138d13 /ctrack/organisations/views.py
parentb58ec416d86fc8a4c7816fe96d2b1030deff37a5 (diff)
engagement events now appear on org page
Diffstat (limited to 'ctrack/organisations/views.py')
-rw-r--r--ctrack/organisations/views.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/ctrack/organisations/views.py b/ctrack/organisations/views.py
index 0dfe21d..394966a 100644
--- a/ctrack/organisations/views.py
+++ b/ctrack/organisations/views.py
@@ -6,6 +6,8 @@ from django.http import HttpResponseRedirect
from django.urls import reverse, reverse_lazy
from django.views.generic import CreateView, DetailView, FormView, ListView
+from ctrack.register.models import EngagementEvent
+
from .forms import AddressInlineFormSet, IncidentReportForm, OrganisationCreateForm
from .models import IncidentReport, Organisation, Person
@@ -59,9 +61,11 @@ class OrganisationDetailView(LoginRequiredMixin, PermissionRequiredMixin, Detail
model = Organisation
permission_required = "organisations.view_organisation"
- def get_context_data(self, **kwargs: Any) -> Dict[str, Any]:
+ def get_context_data(self, **kwargs: Any):
context = super().get_context_data()
org = kwargs["object"]
+ peoples = org.person_set.all()
+ engagement_events = EngagementEvent.objects.filter(participants__in=peoples)
no_addr = org.addresses.count()
if no_addr > 1:
context["no_addr"] = no_addr
@@ -75,6 +79,7 @@ class OrganisationDetailView(LoginRequiredMixin, PermissionRequiredMixin, Detail
context["people"] = people
applicable_systems = org.applicablesystem_set.all()
context["applicable_systems"] = applicable_systems
+ context["engagement_events"] = engagement_events
return context