Fixed info bug on page

This commit is contained in:
Artyom Kravchenko 2021-03-06 01:36:19 +03:00
parent 5909750fcc
commit fe944f4875
2 changed files with 14 additions and 4 deletions

View File

@ -22,13 +22,13 @@
<h6 class="table-title">Список сотрудников с правами инженера</h6> <h6 class="table-title">Список сотрудников с правами инженера</h6>
<table class="light-table"> <table class="light-table">
<thead> <thead>
<th>ID</th> <th>Email</th>
<th>Name</th> <th>Name</th>
</thead> </thead>
<tbody> <tbody>
{% for engineer in engineers %} {% for engineer in engineers %}
<tr> <tr>
<td>{{ engineer.id }}</td> <td>{{ engineer.email }}</td>
<td>{{ engineer.name }}</td> <td>{{ engineer.name }}</td>
</tr> </tr>
{% endfor %} {% endfor %}

View File

@ -128,10 +128,20 @@ def auth_user(request):
@login_required() @login_required()
def work_page(request, id): def work_page(request, id):
users = get_users_list()
if request.user.id == id: if request.user.id == id:
engineers = []
light_agents = []
for user in users:
if user.custom_role_id == ZENDESK_ROLES['engineer']:
engineers.append((user))
elif user.custom_role_id == ZENDESK_ROLES['light_agent']:
light_agents.append(user)
context = { context = {
'engineers': UserProfile.objects.filter(role="admin"), 'engineers': engineers,
'agents': UserProfile.objects.filter(role="agent"), 'agents': light_agents,
'pagename': 'Управление правами' 'pagename': 'Управление правами'
} }
return render(request, 'pages/work.html', context) return render(request, 'pages/work.html', context)