Removed django context, now uses only React

This commit is contained in:
Yuriy Kulakov
2021-04-04 20:03:35 +03:00
parent 575577642c
commit 30407e09dc
3 changed files with 16 additions and 51 deletions

View File

@@ -30,14 +30,6 @@
<div class="row justify-content-center new-section">
{% block hidden_form %}
<div style="display: none">
{% for field in form.users %}
{{ field.tag }}
{% endfor %}
</div>
{% endblock %}
<div class="col-10">
<h6 class="table-title">Список сотрудников</h6>
@@ -50,25 +42,11 @@
<th>Role</th>
<th>Checked</th>
</thead>
<tbody id="old_tbody">
{% for user in users %}
<tr>
<td><a href="#">{{ user.name }}</a></td>
<td>{{ user.user.email }}</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 %}
<tbody id="tbody">
</tbody>
<tbody id="new_tbody"></tbody>
</table>
{% endblock%}
<p id="loading">Данные загружаются...</p>
{% endblock %}
</div>
</div>
@@ -96,7 +74,9 @@
</div>
</div>
{% endblock %}
{% block buttons %}
<div class="col-5">
<button type="submit" name="engineer" class="request-acess-button default-button">
@@ -107,8 +87,9 @@
Назначить выбранных на роль легкого агента
</button>
</div>
{% endblock %}
</div>
{% endblock %}
</form>
{% endblock %}

View File

@@ -285,13 +285,9 @@ class AdminPageView(LoginRequiredMixin, PermissionRequiredMixin,SuccessMessageMi
Функция формирования контента страницы администратора (с проверкой прав доступа)
"""
context = super().get_context_data(**kwargs)
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
return context
class CustomLoginView(LoginView):