diff options
Diffstat (limited to '')
-rw-r--r-- | ctrack/caf/models.py | 2 | ||||
-rw-r--r-- | ctrack/caf/views.py | 4 | ||||
-rw-r--r-- | ctrack/organisations/models.py | 7 | ||||
-rw-r--r-- | ctrack/organisations/templates/organisations/organisation_detail.html | 12 | ||||
-rw-r--r-- | ctrack/organisations/views.py | 5 | ||||
-rwxr-xr-x | utility/remove_migrations.sh | 8 |
6 files changed, 19 insertions, 19 deletions
diff --git a/ctrack/caf/models.py b/ctrack/caf/models.py index b77cfdb..5fd586f 100644 --- a/ctrack/caf/models.py +++ b/ctrack/caf/models.py @@ -149,7 +149,7 @@ class CAF(models.Model): # return first_ass.organisation def sub_mode(self): - return self.organisation().submode + return self.organisation.submode def __str__(self): # Get the organisation and applicable system diff --git a/ctrack/caf/views.py b/ctrack/caf/views.py index 258774e..4eacd08 100644 --- a/ctrack/caf/views.py +++ b/ctrack/caf/views.py @@ -36,8 +36,8 @@ def caf_detail_view(request, pk): context = { "object": caf, "assessments_and_scores": _scrs, - "organisation": ApplicableSystem.objects.filter(caf=caf).first().organisation, - "systems": caf.applicable_systems.all(), + "organisation": caf.organisation, + "systems": caf.systems, } return render(request, "caf/caf_detail.html", context) diff --git a/ctrack/organisations/models.py b/ctrack/organisations/models.py index 78e4801..1c914b5 100644 --- a/ctrack/organisations/models.py +++ b/ctrack/organisations/models.py @@ -162,6 +162,13 @@ class Organisation(models.Model): out.extend(list(es.systems.all())) return out + def systems_for_each_essential_service(self): + ess = self.essentialservice_set.all() + out = [] + for es in ess: + out.extend(es.systems.all()) + return out + class Address(models.Model): organisation = models.ForeignKey( diff --git a/ctrack/organisations/templates/organisations/organisation_detail.html b/ctrack/organisations/templates/organisations/organisation_detail.html index 8c9ac3b..0e981b9 100644 --- a/ctrack/organisations/templates/organisations/organisation_detail.html +++ b/ctrack/organisations/templates/organisations/organisation_detail.html @@ -99,17 +99,7 @@ <div class="col-md-12 my-2"> <div class="card bg-light"> <div class="card-body"> - <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="#">{{ event.type}}</a></td> - <td>{{ event.short_description }}</td> - </tr> - {% endfor %} + <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="#">{{ event.type}}</a></td> <td>{{ event.short_description }}</td> </tr> {% endfor %} {% else %} <a class="btn btn-primary" href="{% url "register:create" %}" role="button">Add new...</a> diff --git a/ctrack/organisations/views.py b/ctrack/organisations/views.py index 394966a..3f91e2f 100644 --- a/ctrack/organisations/views.py +++ b/ctrack/organisations/views.py @@ -10,6 +10,7 @@ from ctrack.register.models import EngagementEvent from .forms import AddressInlineFormSet, IncidentReportForm, OrganisationCreateForm from .models import IncidentReport, Organisation, Person +from ctrack.caf.models import EssentialService class PersonListView(LoginRequiredMixin, PermissionRequiredMixin, ListView): @@ -66,6 +67,7 @@ class OrganisationDetailView(LoginRequiredMixin, PermissionRequiredMixin, Detail org = kwargs["object"] peoples = org.person_set.all() engagement_events = EngagementEvent.objects.filter(participants__in=peoples) + essential_services = EssentialService.objects.filter(organisation=org) no_addr = org.addresses.count() if no_addr > 1: context["no_addr"] = no_addr @@ -77,9 +79,10 @@ class OrganisationDetailView(LoginRequiredMixin, PermissionRequiredMixin, Detail context["addr"] = addr people = org.person_set.all() context["people"] = people - applicable_systems = org.applicablesystem_set.all() + applicable_systems = org.systems_for_each_essential_service() context["applicable_systems"] = applicable_systems context["engagement_events"] = engagement_events + context["essential_services"] = essential_services return context diff --git a/utility/remove_migrations.sh b/utility/remove_migrations.sh index 6b8960a..8e3d6d1 100755 --- a/utility/remove_migrations.sh +++ b/utility/remove_migrations.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash -echo "Removing migrations from all migrations directories, except in .venv..." +echo "Removing migrations from all migrations directories, except in .venv and contrib..." -find . -path "*/migrations/*.py" -not -name "__init__.py" -not -path "./.venv/*" -delete -find . -path "*/migrations/*.pyc" -not -path "./.venv/*" -delete -find . -path "*/migrations/__pycache__" -not -path "./.venv/*" -delete +find . -path "*/migrations/*.py" -not -name "__init__.py" -not -path "./contrib/*" -not -path "./.venv/*" -delete +find . -path "*/migrations/*.pyc" -not -path "./contrib/*" -not -path "./.venv/*" -delete +find . -path "*/migrations/__pycache__" -not -path "./contrib/*" -not -path "./.venv/*" -delete |