aboutsummaryrefslogtreecommitdiffstats
path: root/ctrack/caf
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--ctrack/caf/admin.py14
-rw-r--r--ctrack/caf/migrations/0003_auto_20200221_2104.py4
-rw-r--r--ctrack/caf/migrations/0017_auto_20200304_1925.py32
-rw-r--r--ctrack/caf/models.py8
-rw-r--r--ctrack/caf/templates/caf/applicablesystem_list.html (renamed from ctrack/caf/templates/caf/essentialservice_list.html)22
-rw-r--r--ctrack/caf/tests/factories.py6
-rw-r--r--ctrack/caf/urls.py4
-rw-r--r--ctrack/caf/views.py8
8 files changed, 65 insertions, 33 deletions
diff --git a/ctrack/caf/admin.py b/ctrack/caf/admin.py
index 661a793..5e68ce4 100644
--- a/ctrack/caf/admin.py
+++ b/ctrack/caf/admin.py
@@ -1,15 +1,15 @@
from django.contrib import admin
-from .models import CAF, FileStore, DocumentFile, Grading, EssentialService
+from .models import CAF, FileStore, DocumentFile, Grading, ApplicableSystem
-class EssentialServiceListAdmin(admin.ModelAdmin):
- model = EssentialService
+class ApplicableSystemListAdmin(admin.ModelAdmin):
+ model = ApplicableSystem
list_display = ["name", "organisation", "caf"]
-class EssentialServiceAdmin(admin.StackedInline):
- model = EssentialService
+class ApplicableSystemAdmin(admin.StackedInline):
+ model = ApplicableSystem
max_num = 3
extra = 1
@@ -18,7 +18,7 @@ class CAFAdmin(admin.ModelAdmin):
# TODO - we need the CAF list to show essential services
# but this is a many-to-many relationship, so we need to summarise it somehow
model = CAF
- inlines = [EssentialServiceAdmin]
+ inlines = [ApplicableSystemAdmin]
list_display = ["owner", "quality_grading", "confidence_grading", "file"]
@@ -26,4 +26,4 @@ admin.site.register(CAF, CAFAdmin)
admin.site.register(FileStore)
admin.site.register(DocumentFile)
admin.site.register(Grading)
-admin.site.register(EssentialService, EssentialServiceListAdmin)
+admin.site.register(ApplicableSystem, ApplicableSystemListAdmin)
diff --git a/ctrack/caf/migrations/0003_auto_20200221_2104.py b/ctrack/caf/migrations/0003_auto_20200221_2104.py
index 4726a28..9f5d6ae 100644
--- a/ctrack/caf/migrations/0003_auto_20200221_2104.py
+++ b/ctrack/caf/migrations/0003_auto_20200221_2104.py
@@ -24,10 +24,10 @@ class Migration(migrations.Migration):
('name', models.CharField(max_length=256)),
('description', models.TextField(max_length=1000)),
('caf', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='caf.CAF')),
- ('organisation', models.ForeignKey(on_delete=models.SET(ctrack.caf.models.EssentialService.get_sentinel_org), to='organisations.Organisation')),
+ ('organisation', models.ForeignKey(on_delete=models.SET(ctrack.caf.models.ApplicableSystem.get_sentinel_org), to='organisations.Organisation')),
],
options={
- 'verbose_name': 'Essential Service',
+ 'verbose_name': 'ApplicableSystem',
},
),
]
diff --git a/ctrack/caf/migrations/0017_auto_20200304_1925.py b/ctrack/caf/migrations/0017_auto_20200304_1925.py
new file mode 100644
index 0000000..198558a
--- /dev/null
+++ b/ctrack/caf/migrations/0017_auto_20200304_1925.py
@@ -0,0 +1,32 @@
+# Generated by Django 2.2.9 on 2020-03-04 19:25
+
+import ctrack.caf.models
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('organisations', '0005_auto_20200303_0727'),
+ ('caf', '0016_auto_20200303_0825'),
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='ApplicableSystem',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('name', models.CharField(max_length=256)),
+ ('description', models.TextField(max_length=1000)),
+ ('caf', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='applicable_systems', to='caf.CAF')),
+ ('organisation', models.ForeignKey(on_delete=models.SET(ctrack.caf.models.ApplicableSystem.get_sentinel_org), to='organisations.Organisation')),
+ ],
+ options={
+ 'verbose_name': 'Applicable System',
+ },
+ ),
+ migrations.DeleteModel(
+ name='EssentialService',
+ ),
+ ]
diff --git a/ctrack/caf/models.py b/ctrack/caf/models.py
index 9f01739..0fbfcd8 100644
--- a/ctrack/caf/models.py
+++ b/ctrack/caf/models.py
@@ -36,7 +36,7 @@ class DocumentFile(models.Model):
file_store_location = models.ForeignKey(FileStore, on_delete=models.CASCADE)
-class EssentialService(models.Model):
+class ApplicableSystem(models.Model):
def get_sentinel_org():
"""
We need this so that we can ensure models.SET() is applied with a callable
@@ -50,10 +50,10 @@ class EssentialService(models.Model):
organisation = models.ForeignKey(
Organisation, on_delete=models.SET(get_sentinel_org)
)
- caf = models.ForeignKey("CAF", on_delete=models.CASCADE, blank=True, null=True, related_name="essential_services")
+ caf = models.ForeignKey("CAF", on_delete=models.CASCADE, blank=True, null=True, related_name="applicable_systems")
class Meta:
- verbose_name = "Essential Service"
+ verbose_name = "Applicable System"
def __str__(self):
return f"{self.organisation.name} | {self.name}"
@@ -66,7 +66,7 @@ class CAF(models.Model):
confidence_grading = models.ForeignKey(Grading, on_delete=models.CASCADE, blank=True, null=True,
related_name="confidence_grading")
file = models.ForeignKey(DocumentFile, on_delete=models.CASCADE, blank=True, null=True)
- version = models.CharField(max_length=10, blank=True, null=True)
+ version = models.CharField(max_length=10, blank=True, null=True)
triage_review_date = models.DateField(blank=True, null=True)
triage_review_inspector = models.ForeignKey(Person, on_delete=models.CASCADE, blank=True, null=True)
comments = models.TextField(max_length=1000)
diff --git a/ctrack/caf/templates/caf/essentialservice_list.html b/ctrack/caf/templates/caf/applicablesystem_list.html
index 16bbfba..caeee44 100644
--- a/ctrack/caf/templates/caf/essentialservice_list.html
+++ b/ctrack/caf/templates/caf/applicablesystem_list.html
@@ -2,32 +2,32 @@
{% load static %}
-{% block title %}Essential Services{% endblock %}
+{% block title %}Applicable Systems{% endblock %}
{% block content %}
<div class="container">
<div class="row">
<div class="col-sm-12">
- <h3>Essential Services</h3>
-
+ <h3>Applicable Systems</h3>
+
<table class="table-sm table-striped table-bordered">
<thead>
<tr>
<th>Organisation</th>
- <th>Essential Service</th>
+ <th>System</th>
<th>Sub Mode</th>
<th class="tabaligncenter">Confidence Grade</th>
<th>Triage Review Date</th>
<th>Review Inspector</th>
</tr>
</thead>
- {% for es in object_list %}
+ {% for sys in object_list %}
<tr>
- <td>{{ es.organisation.name }}</td>
- <td>{{ es.name }}</td>
- <td>{{ es.organisation.submode.descriptor }}</td>
- <td class="tabaligncenter">{{ es.caf.confidence_grading.descriptor }}</td>
- <td>{{ es.caf.triage_review_date }}</td>
- <td>{{ es.caf.triage_review_inspector.name }}</td>
+ <td>{{ sys.organisation.name }}</td>
+ <td>{{ sys.name }}</td>
+ <td>{{ sys.organisation.submode.descriptor }}</td>
+ <td class="tabaligncenter">{{ sys.caf.confidence_grading.descriptor }}</td>
+ <td>{{ sys.caf.triage_review_date }}</td>
+ <td>{{ sys.caf.triage_review_inspector.name }}</td>
</tr>
{% endfor %}
</table>
diff --git a/ctrack/caf/tests/factories.py b/ctrack/caf/tests/factories.py
index 2e5bd36..31e2403 100644
--- a/ctrack/caf/tests/factories.py
+++ b/ctrack/caf/tests/factories.py
@@ -3,7 +3,7 @@ import random
import factory
from factory import Faker
-from ctrack.caf.models import EssentialService, Grading, DocumentFile, FileStore, CAF
+from ctrack.caf.models import ApplicableSystem, Grading, DocumentFile, FileStore, CAF
from ctrack.organisations.tests.factories import OrganisationFactory, PersonFactory
@@ -12,7 +12,7 @@ class CAFFactory(factory.DjangoModelFactory):
quality_grading = factory.SubFactory("ctrack.caf.tests.factories.GradingFactory")
confidence_grading = factory.SubFactory("ctrack.caf.tests.factories.GradingFactory")
file = None
- version = Faker("bothify", text="??##", letters="ABCD")
+ version = Faker("bothify", text="??##", letters="ABCD")
triage_review_date = Faker("date_object")
triage_review_inspector = factory.SubFactory(PersonFactory)
comments = Faker("paragraph", nb_sentences=5, variable_nb_sentences=True, ext_word_list=None)
@@ -33,7 +33,7 @@ class EssentialServiceFactory(factory.DjangoModelFactory):
caf = factory.SubFactory("ctrack.caf.tests.factories.CAFFactory")
class Meta:
- model = EssentialService
+ model = ApplicableSystem
class GradingFactory(factory.DjangoModelFactory):
diff --git a/ctrack/caf/urls.py b/ctrack/caf/urls.py
index 9603db5..37fb96b 100644
--- a/ctrack/caf/urls.py
+++ b/ctrack/caf/urls.py
@@ -1,11 +1,11 @@
from django.urls import path
-from ctrack.caf.views import CreateCAF, ListCAF, ListEssentialService
+from ctrack.caf.views import CreateCAF, ListCAF, ListApplicableSystem
app_name = "caf"
urlpatterns = [
path("", view=CreateCAF.as_view(), name="create"),
path("", view=ListCAF.as_view(), name="caf_list"),
- path("essentialservices", view=ListEssentialService.as_view(), name="es_list")
+ path("applicablesystems", view=ListApplicableSystem.as_view(), name="es_list")
]
diff --git a/ctrack/caf/views.py b/ctrack/caf/views.py
index f7863d9..c90cb76 100644
--- a/ctrack/caf/views.py
+++ b/ctrack/caf/views.py
@@ -1,7 +1,7 @@
from django.views.generic import CreateView, ListView
from ctrack.caf.forms import CAFForm
-from ctrack.caf.models import EssentialService
+from ctrack.caf.models import ApplicableSystem
class CreateCAF(CreateView):
@@ -18,15 +18,15 @@ class ListCAF(ListView):
pass
-class ListEssentialService(ListView):
- model = EssentialService
+class ListApplicableSystem(ListView):
+ model = ApplicableSystem
# TODO - add primary_nis_contact tick to the context
# Context can be easily found with:
# org.person_set.filter(primary_nis_contact=True) or similar
def get_queryset(self):
- ess = EssentialService.objects.all().order_by("organisation__name")
+ ess = ApplicableSystem.objects.all().order_by("organisation__name")
return ess
def get_context_data(self, **kwargs):