mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-08 08:28:15 -04:00
Use crown not crown_status as prop name
It’s confusing having a property name which is different from the attribute returned in the JSON from the API.
This commit is contained in:
@@ -27,10 +27,6 @@ class Organisation(JSONModel):
|
|||||||
if self._dict == {}:
|
if self._dict == {}:
|
||||||
self.name, self.crown, self.agreement_signed = None, None, None
|
self.name, self.crown, self.agreement_signed = None, None, None
|
||||||
|
|
||||||
@property
|
|
||||||
def crown_status(self):
|
|
||||||
return self.crown
|
|
||||||
|
|
||||||
def as_human_readable(self, fallback_domain):
|
def as_human_readable(self, fallback_domain):
|
||||||
if 'dwp.' in ''.join(self.domains):
|
if 'dwp.' in ''.join(self.domains):
|
||||||
return 'DWP - Requires OED approval'
|
return 'DWP - Requires OED approval'
|
||||||
@@ -47,7 +43,7 @@ class Organisation(JSONModel):
|
|||||||
True: 'a crown body',
|
True: 'a crown body',
|
||||||
False: 'a non-crown body',
|
False: 'a non-crown body',
|
||||||
None: 'crown status unknown',
|
None: 'crown status unknown',
|
||||||
}.get(self.crown_status),
|
}.get(self.crown),
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
return 'Can’t tell (domain is {})'.format(fallback_domain)
|
return 'Can’t tell (domain is {})'.format(fallback_domain)
|
||||||
@@ -57,7 +53,7 @@ class Organisation(JSONModel):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def as_jinja_template(self):
|
def as_jinja_template(self):
|
||||||
if self.crown_status is None:
|
if self.crown is None:
|
||||||
return 'agreement-choose'
|
return 'agreement-choose'
|
||||||
if self.agreement_signed:
|
if self.agreement_signed:
|
||||||
return 'agreement-signed'
|
return 'agreement-signed'
|
||||||
@@ -133,6 +129,6 @@ class Organisation(JSONModel):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def crown_status_or_404(self):
|
def crown_status_or_404(self):
|
||||||
if self.crown_status is None:
|
if self.crown is None:
|
||||||
abort(404)
|
abort(404)
|
||||||
return self.crown_status
|
return self.crown
|
||||||
|
|||||||
Reference in New Issue
Block a user