Refactor to put user logic inside class

This commit is contained in:
Chris Hill-Scott
2018-03-08 15:13:50 +00:00
parent 2e170a00ba
commit b0278c5649

View File

@@ -462,6 +462,14 @@ class GovernmentDomain:
self.agreement_signed
) = self._get_details_of_domain()
@classmethod
def from_user(cls, user):
return cls(user.email_address if user.is_authenticated else '')
@classmethod
def from_current_user(cls):
return cls.from_user(current_user)
@staticmethod
def get_matching_function(email_address_or_domain):