Fixed role display on profile and admin pages
This commit is contained in:
parent
74823e6c26
commit
3aa84cd04c
18
main/migrations/0015_auto_20210330_0007.py
Normal file
18
main/migrations/0015_auto_20210330_0007.py
Normal file
@ -0,0 +1,18 @@
|
||||
# Generated by Django 3.1.6 on 2021-03-29 21:07
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('main', '0014_auto_20210314_1455'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='unassignedticket',
|
||||
name='status',
|
||||
field=models.IntegerField(choices=[(0, 'Снят с пользователя, перенесён в буферную группу'), (1, 'Авторство восстановлено'), (2, 'Пока нас не было, тикет испарился из буферной группы. Дополнительные действия не требуются'), (3, 'Тикет уже был закрыт. Дополнительные действия не требуются'), (4, 'Тикет решён. Записан на пользователя с почтой SOLVED_TICKETS_EMAIL')], default=0),
|
||||
),
|
||||
]
|
@ -56,7 +56,12 @@
|
||||
<tr>
|
||||
<td><a href="#">{{ user.name }}</a></td>
|
||||
<td>{{ user.user.email }}</td>
|
||||
<td>{{ user.role }}</td>
|
||||
<td>{% if user.custom_role_id == ZENDESK_ROLES.engineer %}
|
||||
engineer
|
||||
{% elif user.custom_role_id == ZENDESK_ROLES.light_agent %}
|
||||
light_agent
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="checkbox_field"></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
@ -37,7 +37,13 @@
|
||||
<br>
|
||||
<h5><span class="badge bg-secondary text-light">Электронная почта</span> {{ profile.user.email }}</h5>
|
||||
<br>
|
||||
<h5><span class="badge bg-secondary text-light">Текущая роль</span> {{ profile.role }}</h5>
|
||||
<h5><span class="badge bg-secondary text-light">Текущая роль</span>
|
||||
{% if profile.custom_role_id == ZENDESK_ROLES.engineer %}
|
||||
engineer
|
||||
{% elif profile.custom_role_id == ZENDESK_ROLES.light_agent %}
|
||||
light_agent
|
||||
{% endif %}
|
||||
</h5>
|
||||
</div>
|
||||
</div>
|
||||
<div align="center">
|
||||
|
@ -104,7 +104,8 @@ def profile_page(request: WSGIRequest) -> HttpResponse:
|
||||
update_profile(user_profile)
|
||||
context = {
|
||||
'profile': user_profile,
|
||||
'pagename': 'Страница профиля'
|
||||
'pagename': 'Страница профиля',
|
||||
'ZENDESK_ROLES': ZENDESK_ROLES,
|
||||
}
|
||||
return render(request, 'pages/profile.html', context)
|
||||
|
||||
@ -203,6 +204,7 @@ class AdminPageView(LoginRequiredMixin, PermissionRequiredMixin, FormView):
|
||||
users = get_list_or_404(
|
||||
UserProfile, role='agent')
|
||||
context['users'] = users
|
||||
context['ZENDESK_ROLES'] = ZENDESK_ROLES
|
||||
context['engineers'], context['light_agents'] = count_users(get_users_list())
|
||||
context['licences_remaining'] = max(0, ZENDESK_MAX_AGENTS - context['engineers'])
|
||||
return context # TODO: need to get profile page url
|
||||
|
Loading…
x
Reference in New Issue
Block a user