Add organisation_type property to Service model

This will return the organisation_type of the service's organisation (if
there is one), or the organisation_type of the service if not.
This commit is contained in:
Katie Smith
2019-07-09 10:38:07 +01:00
parent 53214937a8
commit b6ebbe6f67
2 changed files with 22 additions and 1 deletions

View File

@@ -32,7 +32,6 @@ class Service(JSONModel):
'letter_contact_block',
'message_limit',
'name',
'organisation_type',
'permissions',
'prefix_sms',
'research_mode',
@@ -409,6 +408,10 @@ class Service(JSONModel):
def organisation_id(self):
return self._dict['organisation']
@property
def organisation_type(self):
return self.organisation.organisation_type or self._dict['organisation_type']
@cached_property
def inbound_number(self):
return inbound_number_client.get_inbound_sms_number_for_service(self.id)['data'].get('number', '')