From de0bbafec7d1aac5aaf9c672678c257b62f14d67 Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Thu, 27 Aug 2020 13:56:56 +0100 Subject: essential service now on admin and further work to schema --- ctrack/caf/admin.py | 14 +++++++++++++- ctrack/caf/migrations/0002_caf_systems.py | 18 ++++++++++++++++++ ctrack/caf/models.py | 3 ++- 3 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 ctrack/caf/migrations/0002_caf_systems.py (limited to 'ctrack/caf') diff --git a/ctrack/caf/admin.py b/ctrack/caf/admin.py index e633029..f1aa860 100644 --- a/ctrack/caf/admin.py +++ b/ctrack/caf/admin.py @@ -1,6 +1,17 @@ from django.contrib import admin -from .models import CAF, FileStore, DocumentFile, Grading, ApplicableSystem +from .models import ( + CAF, + FileStore, + DocumentFile, + Grading, + ApplicableSystem, + EssentialService, +) + + +class EssentialServiceAdmin(admin.ModelAdmin): + model = EssentialService class ApplicableSystemListAdmin(admin.ModelAdmin): @@ -31,6 +42,7 @@ class CAFAdmin(admin.ModelAdmin): admin.site.register(CAF, CAFAdmin) +admin.site.register(EssentialService, EssentialServiceAdmin) admin.site.register(FileStore) admin.site.register(DocumentFile) admin.site.register(Grading) diff --git a/ctrack/caf/migrations/0002_caf_systems.py b/ctrack/caf/migrations/0002_caf_systems.py new file mode 100644 index 0000000..9e0f76a --- /dev/null +++ b/ctrack/caf/migrations/0002_caf_systems.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2.12 on 2020-08-27 12:44 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('caf', '0001_initial'), + ] + + operations = [ + migrations.AddField( + model_name='caf', + name='systems', + field=models.ManyToManyField(to='caf.ApplicableSystem'), + ), + ] diff --git a/ctrack/caf/models.py b/ctrack/caf/models.py index fc56c30..b77cfdb 100644 --- a/ctrack/caf/models.py +++ b/ctrack/caf/models.py @@ -89,7 +89,7 @@ class ApplicableSystem(models.Model): return self.organisation.person_set.filter(primary_nis_contact=True) def __str__(self): - return f"{self.organisation.name} | {self.name}" + return self.name objects = ApplicableSystemManager() @@ -128,6 +128,7 @@ class CAF(models.Model): triage_review_inspector = models.ForeignKey( Person, on_delete=models.CASCADE, blank=True, null=True ) + systems = models.ManyToManyField(ApplicableSystem) comments = models.TextField(max_length=1000) class Meta: -- cgit v1.2.3