Restored People and Roles to the original tables
This commit is contained in:
parent
f25cee86c8
commit
ae7cadb738
|
@ -32,9 +32,7 @@ from idhub.admin.forms import (
|
||||||
UserRolForm,
|
UserRolForm,
|
||||||
)
|
)
|
||||||
from idhub.admin.tables import (
|
from idhub.admin.tables import (
|
||||||
UserTable,
|
DashboardTable
|
||||||
DashboardTable,
|
|
||||||
RolesTable
|
|
||||||
)
|
)
|
||||||
from idhub.models import (
|
from idhub.models import (
|
||||||
DID,
|
DID,
|
||||||
|
@ -84,12 +82,10 @@ class ImportExport(AdminView):
|
||||||
section = "ImportExport"
|
section = "ImportExport"
|
||||||
|
|
||||||
|
|
||||||
class PeopleListView(People, SingleTableView):
|
class PeopleListView(People, TemplateView):
|
||||||
template_name = "idhub/admin/people.html"
|
template_name = "idhub/admin/people.html"
|
||||||
subtitle = _('View users')
|
subtitle = _('View users')
|
||||||
icon = 'bi bi-person'
|
icon = 'bi bi-person'
|
||||||
table_class = UserTable
|
|
||||||
model = User
|
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
context = super().get_context_data(**kwargs)
|
context = super().get_context_data(**kwargs)
|
||||||
|
@ -402,20 +398,17 @@ class PeopleRolDeleteView(PeopleView):
|
||||||
return redirect('idhub:admin_people_edit', user.id)
|
return redirect('idhub:admin_people_edit', user.id)
|
||||||
|
|
||||||
|
|
||||||
class RolesView(AccessControl, SingleTableView):
|
class RolesView(AccessControl):
|
||||||
template_name = "idhub/admin/roles.html"
|
template_name = "idhub/admin/roles.html"
|
||||||
subtitle = _('Manage roles')
|
subtitle = _('Manage roles')
|
||||||
icon = ''
|
icon = ''
|
||||||
table_class = RolesTable
|
|
||||||
model = Rol
|
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
queryset = kwargs.pop('object_list', None)
|
context = super().get_context_data(**kwargs)
|
||||||
if queryset is None:
|
context.update({
|
||||||
self.object_list = self.model.objects.all()
|
'roles': Rol.objects,
|
||||||
|
})
|
||||||
return super().get_context_data(**kwargs)
|
return context
|
||||||
|
|
||||||
|
|
||||||
class RolRegisterView(AccessControl, CreateView):
|
class RolRegisterView(AccessControl, CreateView):
|
||||||
template_name = "idhub/admin/rol_register.html"
|
template_name = "idhub/admin/rol_register.html"
|
||||||
|
|
|
@ -1,11 +1,39 @@
|
||||||
{% extends "idhub/base_admin.html" %}
|
{% extends "idhub/base_admin.html" %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
{% load render_table from django_tables2 %}
|
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h3>
|
<h3>
|
||||||
<i class="{{ icon }}"></i>
|
<i class="{{ icon }}"></i>
|
||||||
{{ subtitle }}
|
{{ subtitle }}
|
||||||
</h3>
|
</h3>
|
||||||
{% render_table table %}
|
<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">Email</button></th>
|
||||||
|
<th scope="col" class="text-center"><button type="button" class="btn btn-grey border border-dark">{% trans 'Membership' %}</button></th>
|
||||||
|
<th scope="col" class="text-center"><button type="button" class="btn btn-grey border border-dark">{% trans 'Role' %}</button></th>
|
||||||
|
<th scope="col"></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for user in users %}
|
||||||
|
<tr>
|
||||||
|
<td>{{ user.last_name|default:'' }}</td>
|
||||||
|
<td>{{ user.first_name|default:'' }}</td>
|
||||||
|
<td>{{ user.email }}</td>
|
||||||
|
<td class="text-center">
|
||||||
|
{{ user.get_memberships }}
|
||||||
|
</td>
|
||||||
|
<td class="text-center">
|
||||||
|
{{ user.get_roles }}
|
||||||
|
</td>
|
||||||
|
<td><a type="button" class="text-primary" href="{% url 'idhub:admin_people' user.id %}" title="{% trans 'View' %}"><i class="bi bi-eye"></i></td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -1,11 +1,38 @@
|
||||||
{% extends "idhub/base_admin.html" %}
|
{% extends "idhub/base_admin.html" %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
{% load render_table from django_tables2 %}
|
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h3>
|
<h3>
|
||||||
<i class="{{ icon }}"></i>
|
<i class="{{ icon }}"></i>
|
||||||
{{ subtitle }}
|
{{ subtitle }}
|
||||||
</h3>
|
</h3>
|
||||||
{% render_table table %}
|
<div class="row mt-5">
|
||||||
|
<div class="col">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-striped table-sm">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<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 'Description' %}</button></th>
|
||||||
|
<th scope="col"></th>
|
||||||
|
<th scope="col"></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for rol in roles.all %}
|
||||||
|
<tr>
|
||||||
|
<td>{{ rol.name }}</td>
|
||||||
|
<td>{{ rol.description|default:""}}</td>
|
||||||
|
<td><a href="{% url 'idhub:admin_rol_edit' rol.id %}" title="{% trans 'Edit' %}"><i class="bi bi-pencil-square"></i></a></td>
|
||||||
|
<td><a href="{% url 'idhub:admin_rol_del' rol.id %}" title="{% trans 'Delete' %}"><i class="bi bi-trash"></i></a></td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<div class="form-actions-no-box">
|
||||||
|
<a class="btn btn-green-admin" href="{% url 'idhub:admin_rol_new' %}">{% translate "Add Role" %} <i class="bi bi-plus"></i></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
Loading…
Reference in New Issue