diff options
author | Matthew Lemon <lemon@matthewlemon.com> | 2020-10-16 13:54:53 +0100 |
---|---|---|
committer | Matthew Lemon <lemon@matthewlemon.com> | 2020-10-16 14:01:06 +0100 |
commit | d55de5277f54a2a88eae8b7ec27585bc9a0df165 (patch) | |
tree | 97f4bd87a9394355ab58b34e3a1abca12ebc344e /ctrack/organisations | |
parent | eb8497dcd3758d20447d4de977780c2c78a38613 (diff) |
participants added to create new simple event form and can filter by org when landed from org detail
Diffstat (limited to 'ctrack/organisations')
-rw-r--r-- | ctrack/organisations/models.py | 3 | ||||
-rw-r--r-- | ctrack/organisations/tests/test_models.py | 11 |
2 files changed, 12 insertions, 2 deletions
diff --git a/ctrack/organisations/models.py b/ctrack/organisations/models.py index f884d39..c7394e4 100644 --- a/ctrack/organisations/models.py +++ b/ctrack/organisations/models.py @@ -154,6 +154,9 @@ class Organisation(models.Model): def __str__(self): return self.name + def get_people(self): + return self.person_set.all() + def primary_contacts(self): return self.person_set.filter(primary_nis_contact=True) diff --git a/ctrack/organisations/tests/test_models.py b/ctrack/organisations/tests/test_models.py index adb61d9..e4caeb5 100644 --- a/ctrack/organisations/tests/test_models.py +++ b/ctrack/organisations/tests/test_models.py @@ -7,10 +7,17 @@ from ctrack.caf.models import CAF, Grading from ctrack.caf.models import EssentialService from ctrack.caf.tests.factories import ApplicableSystemFactory from ctrack.core.utils import fnames +from ctrack.organisations.tests.factories import PersonFactory pytestmark = pytest.mark.django_db +def test_get_people(org, person): + person.organisation = org + person.save() + assert person in org.get_people() + + def test_lead_deputy_inspector(org): assert org.lead_inspector assert org.deputy_lead_inspector @@ -45,8 +52,8 @@ def test_essential_service(org): triage_review_date=None, triage_review_inspector=None, ) - ass = ApplicableSystemFactory.create(name=random.choice(fnames), caf=caf,) - ass2 = ApplicableSystemFactory.create(name=random.choice(fnames), caf=caf,) + ass = ApplicableSystemFactory.create(name=random.choice(fnames), caf=caf, ) + ass2 = ApplicableSystemFactory.create(name=random.choice(fnames), caf=caf, ) es = EssentialService.objects.create( name="Test ES", description="Test ES Description", organisation=org ) |