fixed UserProfile model
This commit is contained in:
parent
9068febd30
commit
5665282ce5
@ -156,7 +156,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()
|
||||
|
||||
|
23
main/migrations/0012_auto_20210312_1225.py
Normal file
23
main/migrations/0012_auto_20210312_1225.py
Normal 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),
|
||||
),
|
||||
]
|
@ -13,7 +13,8 @@ class UserProfile(models.Model):
|
||||
)
|
||||
|
||||
user = models.OneToOneField(to=User, on_delete=models.CASCADE, help_text='Пользователь')
|
||||
role = models.IntegerField(default=0, 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='Имя пользователя на нашем сайте')
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user