Improve superuser display

This commit is contained in:
Kumi 2019-03-10 11:45:35 +00:00
parent 24cfa48988
commit 989057d66c
3 changed files with 5 additions and 2 deletions

View file

@ -13,6 +13,9 @@ class Organization(models.Model):
def __str__(self):
return self.name
def orgausers(self):
return self.users.filter(is_superuser=False)
class Network(models.Model):
name = models.CharField("Common Name", max_length=64, blank=True, null=True)
extip = models.CharField("External/Public IP", max_length=15, unique=True)

View file

@ -26,7 +26,7 @@
<select multiple required class="custom-select mr-sm-2" id="orga" name="orga">
{% allOrgas as orgas %}
{% for choice in orgas %}
<option {% if choice.userlimit and choice.userlimit <= choice.users.all|length %}disabled{% endif %} value="{{ choice.id }}">{{ choice }} {% if choice.userlimit %}({{ choice.users.all|length }} / {{ choice.userlimit }}){% endif %}</option>
<option {% if choice.userlimit and choice.userlimit <= choice.orgausers.all|length %}disabled{% endif %} value="{{ choice.id }}">{{ choice }} {% if choice.userlimit %}({{ choice.orgausers.all|length }} / {{ choice.userlimit }}){% endif %}</option>
{% endfor %}
</select>
</div>

View file

@ -91,7 +91,7 @@
{% userUsers as users %}
{% for auser in users %}
<tr data-orga="{% directOrgaAjax auser %}">
<td><div style="display:inline;" {% if user.is_superuser %}title="{% directOrgaString auser %}"{% endif %}>{% if auser.is_staff %}<b>{% endif %}{{ auser.username }}{% if auser.is_staff %}</b>{% endif %}</div></td>
<td><div style="display:inline;" {% if user.is_superuser %}title="{% directOrgaString auser %}"{% endif %}>{% if auser.is_superuser %}<i class="fas fa-concierge-bell" style="color:gold;" title="Technical Support"></i> {% endif %}{% if auser.is_staff %}<b>{% endif %}{{ auser.username }}{% if auser.is_staff %}</b>{% endif %}</div></td>
<td>{% if auser.is_staff %}<b>{% endif %}{{ auser.first_name }} {{ auser.last_name }}{% if auser.is_staff %}</b>{% endif %}</td>
<td>{{ auser.userstatus.last_action }}</td>
<td>{% if user.is_staff %}<a href="/users/{{ auser.id }}/edit"><i class="fas fa-edit" title="Edit User"></i></a> {% endif %}{% if auser.email %}<a href="mailto:{{ auser.email }}"><i class="fas fa-envelope" title="Send Email"></i></a>{% endif %}{% if user.is_superuser %} <a href="#"><i style="color: darkred;" onclick="askdeleteuser({{ auser.id }});" class="fas fa-trash-alt" title="Delete User"></i></a>{% endif %}</td>