Commit 51251fac authored by Giorgos Korfiatis's avatar Giorgos Korfiatis

astakos: Properly display user status

Fix AstakosUser.status_display so as not to miss some states. Include all
related flags in user-show and group them together.
parent f6dcfc43
......@@ -96,7 +96,6 @@ class Command(SynnefoCommand):
('email', user.email),
('first name', user.first_name),
('last name', user.last_name),
('active', user.is_active),
('admin', user.is_superuser),
('last login', user.last_login),
('date joined', user.date_joined),
......@@ -104,12 +103,14 @@ class Command(SynnefoCommand):
#('token', user.auth_token),
('token expiration', user.auth_token_expires),
('providers', user.auth_providers_display),
('verified', user.is_verified),
('groups', [elem.name for elem in user.groups.all()]),
('permissions', [elem.codename
for elem in user.user_permissions.all()]),
('group permissions', user.get_group_permissions()),
('email verified', user.email_verified),
('email_verified', user.email_verified),
('moderated', user.moderated),
('rejected', user.is_rejected),
('active', user.is_active),
('username', user.username),
('activation_sent_date', user.activation_sent),
])
......
......@@ -603,23 +603,22 @@ class AstakosUser(User):
@property
def status_display(self):
msg = ""
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:
elif 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:
elif self.is_rejected:
msg = "Rejected"
if self.rejected_reason:
msg += " (%s)" % self.rejected_reason
# accepted
else:
if self.is_active:
msg = "Accepted/Active"
else:
msg = "Accepted/Inactive"
if self.deactivated_reason:
msg += " (%s)" % (self.deactivated_reason)
if self.accepted_policy == 'manual':
msg += " (manually accepted)"
else:
......
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