mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-05-02 15:11:13 -04:00
Add human-readable form of a government domain
This makes it easier to write a good message in the request to go live submission. And encapsulating it in the `GovernmentDomain` class keeps the view nice and clean.
This commit is contained in:
20
app/utils.py
20
app/utils.py
@@ -470,6 +470,26 @@ class GovernmentDomain:
|
||||
def from_current_user(cls):
|
||||
return cls.from_user(current_user)
|
||||
|
||||
@property
|
||||
def as_human_readable(self):
|
||||
if self.agreement_signed:
|
||||
return 'Yes, on behalf of {}'.format(self.owner)
|
||||
elif self.owner:
|
||||
return '{} (organisation is {}, {})'.format(
|
||||
{
|
||||
False: 'No',
|
||||
None: 'Can’t tell',
|
||||
}.get(self.agreement_signed),
|
||||
self.owner,
|
||||
{
|
||||
True: 'a crown body',
|
||||
False: 'a non-crown body',
|
||||
None: 'crown status unknown',
|
||||
}.get(self.crown_status),
|
||||
)
|
||||
else:
|
||||
return 'Can’t tell'
|
||||
|
||||
@staticmethod
|
||||
def get_matching_function(email_address_or_domain):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user