add admin user list

This commit is contained in:
Cayo Puigdefabregas 2023-10-11 16:23:45 +02:00
parent c17e0341ee
commit 6491760abc
2 changed files with 33 additions and 0 deletions

View File

@ -2,6 +2,7 @@ import logging
from django.utils.translation import gettext_lazy as _
from django.views.generic.base import TemplateView
from django.contrib.auth.models import User
from django.urls import reverse_lazy
from django.contrib import messages
from idhub.mixins import AdminView
@ -44,6 +45,12 @@ class AdminPeopleView(People):
subtitle = _('People list')
icon = 'bi bi-person'
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context.update({
'users': User.objects.filter(),
})
return context
class AdminPeopleRegisterView(People):
template_name = "idhub/admin_people_register.html"

View File

@ -2,4 +2,30 @@
{% load i18n %}
{% block content %}
<div class="table-responsive">
<table class="table table-striped table-sm">
<thead>
<tr>
<th scope="col"><button type="button" class="btn btn-green-admin border border-dark">{% trans 'Last name' %}</button></th>
<th scope="col"><button type="button" class="btn btn-grey border border-dark">{% trans 'First name' %}</button></th>
<th scope="col"><button type="button" class="btn btn-grey border border-dark">Username</button></th>
<th scope="col"><button type="button" class="btn btn-grey border border-dark">{% trans 'Role' %}</button></th>
<th scope="col"><button type="button" class="btn btn-grey border border-dark">{% trans 'Membership' %}</button></th>
<th scope="col"></th>
</tr>
</thead>
<tbody>
{% for user in users %}
<tr>
<td>{{ user.last_name }}</td>
<td>{{ user.first_name }}</td>
<td>{{ user.username }}</td>
<td>{{ user.get_membership }}</td>
<td>{{ user.get_role }}</td>
<td><a type="button" class="btn btn-green-admin rounded-pill" href="{# url 'admin.profile.edit', user.id #}">{% trans 'View' %}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endblock %}