mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-05 01:16:27 +00:00
Improve user history view event format
This commit is contained in:
parent
7ed004f564
commit
156a069238
2 changed files with 18 additions and 9 deletions
|
@ -232,24 +232,30 @@ class UserHistoryEvent:
|
|||
:param value: the value of the field
|
||||
:return: object
|
||||
"""
|
||||
if name == "groups" and value is not None:
|
||||
if name == "groups":
|
||||
if len(value) == 0:
|
||||
# Removed all the user's groups
|
||||
return _("None")
|
||||
|
||||
# value is a list of ints
|
||||
groups = []
|
||||
for gid in value:
|
||||
# Try to get the group name, if it's not deleted
|
||||
try:
|
||||
groups.append(Group.objects.get(id=gid))
|
||||
groups.append(Group.objects.get(id=gid).name)
|
||||
except Group.DoesNotExist:
|
||||
# TODO: Find the group name in the versions?
|
||||
groups.append(_("Deleted"))
|
||||
|
||||
return ", ".join(groups)
|
||||
elif name == "state":
|
||||
if value is not None:
|
||||
return User.STATES[value]
|
||||
return User.STATES[value][1]
|
||||
else:
|
||||
return _("Unknown")
|
||||
elif name == "email_state":
|
||||
if value is not None:
|
||||
return User.EMAIL_STATES[value]
|
||||
return User.EMAIL_STATES[value][1]
|
||||
else:
|
||||
return _("Unknown")
|
||||
|
||||
|
|
|
@ -53,12 +53,15 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
</td>
|
||||
<td>
|
||||
{% for edit in event.edits %}
|
||||
{% if edit.1 and edit.2 %}
|
||||
{{ edit.0 }}: {{ edit.1 }} ➔ {{ edit.2 }}<br/>
|
||||
{% elif edit.2 %}
|
||||
{{ edit.0 }}: {{ edit.2 }}<br/>
|
||||
{% if edit.1 is None and edit.2 is None %}
|
||||
<strong>{{ edit.0 }}</strong><br/>
|
||||
{% elif edit.1 is None %}
|
||||
<strong>{{ edit.0 }}:</strong>
|
||||
<i class="text-success"> {{ edit.2 }}</i><br/>
|
||||
{% else %}
|
||||
{{ edit.0 }}<br/>
|
||||
<strong>{{ edit.0 }}:</strong>
|
||||
<i class="text-danger"> {{ edit.1 }} </i>
|
||||
➔ <i class="text-success">{{ edit.2 }}</i><br/>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</td>
|
||||
|
|
Loading…
Reference in a new issue