Merge pull request #3013 from alphagov/org-client-refactor

Wrap get org methods in class method on model
This commit is contained in:
Chris Hill-Scott
2019-06-14 16:56:02 +01:00
committed by GitHub
3 changed files with 10 additions and 8 deletions

View File

@@ -15,7 +15,6 @@ from app.models.roles_and_permissions import (
from app.notify_client import InviteTokenError
from app.notify_client.invite_api_client import invite_api_client
from app.notify_client.org_invite_api_client import org_invite_api_client
from app.notify_client.organisations_api_client import organisations_client
from app.notify_client.user_api_client import user_api_client
from app.utils import is_gov_user
@@ -306,9 +305,7 @@ class User(JSONModel, UserMixin):
@cached_property
def default_organisation(self):
return Organisation(
organisations_client.get_organisation_by_domain(self.email_domain)
)
return Organisation.from_domain(self.email_domain)
@property
def default_organisation_type(self):