Fix unnecessary call to organisation API endpoint

We’re caching the organisation name, but still talking to the API
to see if the organisation exists.

`Service().organisation_id` only goes to the JSON for the service.

`Service().organisation` makes a separate API call.

We only need the former to know if a service belongs to an organisation.
This commit is contained in:
Chris Hill-Scott
2020-04-02 15:06:03 +01:00
parent a709ee4a29
commit 047ca8a48c
3 changed files with 54 additions and 2 deletions

View File

@@ -472,7 +472,7 @@ class Service(JSONModel):
@property
def organisation_name(self):
if not self.organisation:
if not self.organisation_id:
return None
return organisations_client.get_organisation_name(self.organisation_id)