Commit 7d77cbbe authored by Kostas Papadimitriou's avatar Kostas Papadimitriou
Browse files

astakos: Add AstakosUser status_display property

the property provides a status outline of the current user status.
parent 71ee107e
......@@ -82,6 +82,7 @@ class Command(SynnefoCommand):
[
('id', user.id),
('uuid', user.uuid),
('status', user.status_display),
('email', user.email),
('first name', user.first_name),
('last name', user.last_name),
......
......@@ -543,6 +543,33 @@ class AstakosUser(User):
def email_change_is_pending(self):
return self.emailchanges.count() > 0
@property
def status_display(self):
msg = ""
append = None
if self.is_active:
msg = "Accepted/Active"
if self.is_rejected:
msg = "Rejected"
if self.rejected_reason:
msg += " (%s)" % self.rejected_reason
if not self.email_verified:
msg = "Pending email verification"
if not self.moderated:
msg = "Pending moderation"
if not self.is_active and self.email_verified:
msg = "Accepted/Inactive"
if self.deactivated_reason:
msg += " (%s)" % (self.deactivated_reason)
if self.moderated and not self.is_rejected:
if self.accepted_policy == 'manual':
msg += " (manually accepted)"
else:
msg += " (accepted policy: %s)" % \
self.accepted_policy
return msg
@property
def signed_terms(self):
term = get_latest_terms()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment