aboutsummaryrefslogtreecommitdiffstats
path: root/ctrack/organisations
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
parentb58ec416d86fc8a4c7816fe96d2b1030deff37a5 (diff)
engagement events now appear on org page
Diffstat (limited to 'ctrack/organisations')
-rw-r--r--ctrack/organisations/templates/organisations/organisation_detail.html12
-rw-r--r--ctrack/organisations/views.py7
2 files changed, 10 insertions, 9 deletions
diff --git a/ctrack/organisations/templates/organisations/organisation_detail.html b/ctrack/organisations/templates/organisations/organisation_detail.html
index 29d188c..bf16c87 100644
--- a/ctrack/organisations/templates/organisations/organisation_detail.html
+++ b/ctrack/organisations/templates/organisations/organisation_detail.html
@@ -99,23 +99,19 @@
<div class="col-md-12 my-2">
<div class="card bg-light">
<div class="card-body">
- <div class="card-title">OES Engagements<a href="#" class="btn btn-primary btn-sm float-right">Add
+ <div class="card-title">OES Engagements<a href="{% url "register:create" %}" class="btn btn-primary btn-sm float-right">Add
new...</a></div>
<div class="table table-responsive">
<table class="table">
{% if engagement_events|length > 0 %}
{% for event in engagement_events %}
<tr>
- <td><a href="{% url "caf:ass_detail" ass.id %}">{{ ass.name }}</a></td>
- <td>{{ ass.description }}<br>
- <a href="{% url "caf:detail" ass.caf.pk %}" class="small">
- {{ ass.caf }}
- </a> <span class="text-muted"> | <a href="#" class="small">Edit System</a></span>
- </td>
+ <td><a href="#">{{ event.type}}</a></td>
+ <td>{{ event.short_description }}</td>
</tr>
{% endfor %}
{% else %}
- <a class="btn btn-primary" href="{% url "caf:create_from_org" object.slug %}" role="button">Add
+ <a class="btn btn-primary" href="{% url "register:create" %}" role="button">Add
new...</a>
{% endif %}
</table>
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