Add model attribute for profile completeness

This commit is contained in:
Patrick Smith
2018-10-29 16:16:47 -04:00
parent 891dcc5b31
commit f8c4386d84
2 changed files with 26 additions and 0 deletions

View File

@@ -38,6 +38,15 @@ class User(Base, mixins.TimestampsMixin, mixins.AuditableMixin):
"date_latest_training",
]
@property
def profile_complete(self):
return all(
[
getattr(self, field_name) is not None
for field_name in self.REQUIRED_FIELDS
]
)
@property
def atat_permissions(self):
return self.atat_role.permissions