update user_relations_excel
This commit is contained in:
@@ -61,6 +61,21 @@ class AuthExcelViewSet(viewsets.ModelViewSet):
|
||||
create_header_freez(worksheet, excel_options, 1, 6, 7, height=22, width=20)
|
||||
l = 6
|
||||
m = 1
|
||||
|
||||
fa_permissions_dict = {
|
||||
"permission_control": "مدیریت دسترسی",
|
||||
"users": "کاربران",
|
||||
"organizations": "سازمان ها",
|
||||
"roles_management": "مدیریت نقش",
|
||||
"feed_input_products": "محصولات",
|
||||
"product_categories": "دسته بندی محصولات",
|
||||
"pricing": "قیمت گذاری",
|
||||
"incentive_plans": "طرح های تشویقی",
|
||||
"quota": "سهم بندی",
|
||||
"quota_distributions": "صفحه توزیع سهمیه",
|
||||
"inventory": "انبار"
|
||||
}
|
||||
|
||||
if ser_data:
|
||||
for data in ser_data:
|
||||
is_active = 'فعال' if (data.get('user') or {}).get('is_active', False) else 'غیرفعال'
|
||||
@@ -68,6 +83,11 @@ class AuthExcelViewSet(viewsets.ModelViewSet):
|
||||
city = str((data.get('user') or {}).get('city_name', '')) or '-'
|
||||
province = str((data.get('user') or {}).get('province_name', '')) or '-'
|
||||
city_province = f"{city}/{province}" if city != '-' or province != '-' else '-'
|
||||
permission_name = [name for name in data['permission']['page_name']]
|
||||
fa_permissions = [fa_permissions_dict.get(name, name) for name in permission_name]
|
||||
|
||||
# اگر لیست خالی بود، نمایش '-'
|
||||
fa_permission_text = ' - '.join(fa_permissions) if fa_permissions else '-'
|
||||
|
||||
list1 = [
|
||||
m,
|
||||
@@ -81,6 +101,7 @@ class AuthExcelViewSet(viewsets.ModelViewSet):
|
||||
city_province,
|
||||
str((data.get('user') or {}).get('address', '')) or '-',
|
||||
is_active,
|
||||
fa_permission_text
|
||||
]
|
||||
create_value(worksheet, list1, l + 1, 1, m=m)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user