Added engineers and light_agents count from organization to control page
This commit is contained in:
parent
a12476ff70
commit
8df2b66b7a
@ -134,8 +134,8 @@ def make_light_agent(user_profile):
|
|||||||
def get_users_list():
|
def get_users_list():
|
||||||
zendesk = ZendeskAdmin()
|
zendesk = ZendeskAdmin()
|
||||||
admin = zendesk.get_user(zendesk.email)
|
admin = zendesk.get_user(zendesk.email)
|
||||||
group = next(zendesk.admin.users.groups(user=admin)) # TODO: user can be in many groups
|
org = next(zendesk.admin.users.organizations(user=admin))
|
||||||
return zendesk.admin.groups.users(group) # TODO: add role parameter
|
return zendesk.admin.organizations.users(org)
|
||||||
|
|
||||||
|
|
||||||
def update_profile(user_profile: UserProfile):
|
def update_profile(user_profile: UserProfile):
|
||||||
|
@ -2,13 +2,9 @@
|
|||||||
|
|
||||||
{% load static %}
|
{% load static %}
|
||||||
|
|
||||||
{% block title %}
|
{% block title %}Управление{%endblock %}
|
||||||
Управление
|
|
||||||
{%endblock %}
|
|
||||||
|
|
||||||
{% block heading %}
|
{% block heading %}Управление{% endblock %}
|
||||||
Управление
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block extra_css %}
|
{% block extra_css %}
|
||||||
<link rel="stylesheet" href="{% static 'main/css/work.css' %}"/>
|
<link rel="stylesheet" href="{% static 'main/css/work.css' %}"/>
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
{% extends 'base/base.html' %}
|
{% extends 'base/base.html' %}
|
||||||
{% block title %}
|
|
||||||
Авторизация
|
{% block title %}Авторизация{% endblock %}
|
||||||
{% endblock %}
|
|
||||||
{% block heading %}
|
{% block heading %}Авторизация{% endblock %}
|
||||||
Авторизация
|
|
||||||
{% endblock %}
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="card mx-auto" style="width: 40rem">
|
<div class="card mx-auto" style="width: 40rem">
|
||||||
|
@ -114,13 +114,11 @@ class AdminPageView(FormView, LoginRequiredMixin):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def make_engineers(users):
|
def make_engineers(users):
|
||||||
for user in users:
|
[make_engineer(user) for user in users]
|
||||||
make_engineer(user)
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def make_light_agents(users):
|
def make_light_agents(users):
|
||||||
for user in users:
|
[make_light_agent(user) for user in users]
|
||||||
make_light_agent(user)
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def count_users(users): # TODO: this func counts users from all zendesk instead of just from a model
|
def count_users(users): # TODO: this func counts users from all zendesk instead of just from a model
|
||||||
@ -132,7 +130,7 @@ class AdminPageView(FormView, LoginRequiredMixin):
|
|||||||
light_agents += 1
|
light_agents += 1
|
||||||
return engineers, light_agents
|
return engineers, light_agents
|
||||||
|
|
||||||
def get_context_data(self, **kwargs): # TODO: add engineers and agents count
|
def get_context_data(self, **kwargs):
|
||||||
if self.request.user.userprofile.role != 'admin':
|
if self.request.user.userprofile.role != 'admin':
|
||||||
raise PermissionDenied
|
raise PermissionDenied
|
||||||
context = super().get_context_data(**kwargs)
|
context = super().get_context_data(**kwargs)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user