Merge branch 'develop' into hotfix/ticket_unassignment

# Conflicts:
#	main/models.py
This commit is contained in:
Sokurov Idar 2021-03-14 13:12:59 +03:00
commit 1cd8874e03
6 changed files with 34 additions and 8 deletions

View File

@ -181,7 +181,8 @@ def update_profile(user_profile: UserProfile) -> UserProfile:
"""
user = ZendeskAdmin().get_user(user_profile.user.email)
user_profile.name = user.name
user_profile.role = user.custom_role_id if user.custom_role_id else 0
user_profile.role = user.role
user_profile.custom_role_id = user.custom_role_id if user.custom_role_id else 0
user_profile.image = user.photo['content_url'] if user.photo else None
user_profile.save()

View File

@ -39,10 +39,11 @@ class AdminPageUsers(forms.Form):
"""
users = forms.ModelMultipleChoiceField(
queryset=UserProfile.objects.all(),
queryset=UserProfile.objects.filter(role='agent'),
widget=forms.CheckboxSelectMultiple(
attrs={
'class': 'form-check-input'
'class': 'form-check-input',
}
),
label=''

View File

@ -0,0 +1,23 @@
# Generated by Django 3.1.6 on 2021-03-12 09:25
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0011_auto_20210311_1734'),
]
operations = [
migrations.AddField(
model_name='userprofile',
name='custom_role_id',
field=models.IntegerField(default=0, help_text='Код роли пользователя'),
),
migrations.AlterField(
model_name='userprofile',
name='role',
field=models.CharField(default='None', help_text='Глобальное имя роли пользователя', max_length=100),
),
]

View File

@ -13,8 +13,9 @@ class UserProfile(models.Model):
('has_control_access', 'Can view admin page'),
)
user = models.OneToOneField(to=User, on_delete=models.CASCADE, help_text='Пользователь', related_name='user')
role = models.IntegerField(default=0, help_text='Код роли пользователя')
user = models.OneToOneField(to=User, on_delete=models.CASCADE, help_text='Пользователь')
role = models.CharField(default='None', max_length=100, help_text='Глобальное имя роли пользователя')
custom_role_id = models.IntegerField(default=0, help_text='Код роли пользователя')
image = models.URLField(null=True, blank=True, help_text='Аватарка')
name = models.CharField(default='None', max_length=100, help_text='Имя пользователя на нашем сайте')

View File

@ -3,10 +3,10 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<nav class="navbar navbar-light" style="background-color: #00FF00;">
<nav class="navbar navbar-light" style="background-color: #113A60;">
<a class="navbar-brand" href="{% url 'index' %}">
<img src="{% static 'main/img/logo.png' %}" width="30" height="30" class="d-inline-block align-top" alt="" loading="lazy">
Access Controller
<img src="{% static 'main/img/logo_real.png' %}" width="107" height="22" class="d-inline-block align-top" alt="" loading="lazy">
<t style="color:#FFFFFF">Access Controller</t>
</a>
{% if request.user.is_authenticated %}
<div class="btn-group" role="group" aria-label="Basic example">

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB