From ab2a453a540c98e116557f8638a5336d857cf95d Mon Sep 17 00:00:00 2001 From: 7nimor Date: Sat, 16 Aug 2025 08:27:04 +0330 Subject: [PATCH 1/2] add excelstyler librery --- .idea/Rasaddam_Backend.iml | 2 +- .idea/misc.xml | 2 +- apps/authorization/services/excel/excel_processing.py | 6 ++++-- requirements.txt | 1 + 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.idea/Rasaddam_Backend.iml b/.idea/Rasaddam_Backend.iml index 168bde0..c5d6090 100644 --- a/.idea/Rasaddam_Backend.iml +++ b/.idea/Rasaddam_Backend.iml @@ -14,7 +14,7 @@ - + diff --git a/.idea/misc.xml b/.idea/misc.xml index 296aa57..29f5506 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,4 +1,4 @@ - + \ No newline at end of file diff --git a/apps/authorization/services/excel/excel_processing.py b/apps/authorization/services/excel/excel_processing.py index ab42af2..5c20f82 100644 --- a/apps/authorization/services/excel/excel_processing.py +++ b/apps/authorization/services/excel/excel_processing.py @@ -1,6 +1,9 @@ from io import BytesIO from django.http import HttpResponse +from excelstyler.headers import create_header_freez +from excelstyler.helpers import excel_description +from excelstyler.values import create_value from openpyxl import Workbook from rest_framework import viewsets from rest_framework.decorators import action @@ -8,7 +11,6 @@ from rest_framework.decorators import action from apps.authorization.api.v1.serializers import UserRelationSerializer from apps.authorization.models import UserRelations from apps.core.mixins.search_mixin import DynamicSearchMixin -from common.helper_excel import excel_description, create_header_freez, create_value class AuthExcelViewSet(viewsets.ModelViewSet, DynamicSearchMixin): @@ -49,7 +51,7 @@ class AuthExcelViewSet(viewsets.ModelViewSet, DynamicSearchMixin): "دسترسی ها" ] - excel_description(worksheet, 'B1', f'کاربران', row2='C3') + excel_description(worksheet, 'B1', f'کاربران', to_row='C3') create_header_freez(worksheet, excel_options, 1, 6, 7, height=25, width=20) l = 6 diff --git a/requirements.txt b/requirements.txt index 153ee4b..f9d3854 100644 --- a/requirements.txt +++ b/requirements.txt @@ -26,6 +26,7 @@ djangorestframework-jwt djangorestframework_simplejwt djangorestframework-recursive docopt +excelstyler gunicorn idna importlib-metadata From bdd6acc7ca742be677d3bb9f1ac312c80a2110c7 Mon Sep 17 00:00:00 2001 From: 7nimor Date: Sat, 16 Aug 2025 08:52:00 +0330 Subject: [PATCH 2/2] add excelstyler librery --- apps/authorization/services/excel/excel_processing.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/apps/authorization/services/excel/excel_processing.py b/apps/authorization/services/excel/excel_processing.py index 5c20f82..ab42af2 100644 --- a/apps/authorization/services/excel/excel_processing.py +++ b/apps/authorization/services/excel/excel_processing.py @@ -1,9 +1,6 @@ from io import BytesIO from django.http import HttpResponse -from excelstyler.headers import create_header_freez -from excelstyler.helpers import excel_description -from excelstyler.values import create_value from openpyxl import Workbook from rest_framework import viewsets from rest_framework.decorators import action @@ -11,6 +8,7 @@ from rest_framework.decorators import action from apps.authorization.api.v1.serializers import UserRelationSerializer from apps.authorization.models import UserRelations from apps.core.mixins.search_mixin import DynamicSearchMixin +from common.helper_excel import excel_description, create_header_freez, create_value class AuthExcelViewSet(viewsets.ModelViewSet, DynamicSearchMixin): @@ -51,7 +49,7 @@ class AuthExcelViewSet(viewsets.ModelViewSet, DynamicSearchMixin): "دسترسی ها" ] - excel_description(worksheet, 'B1', f'کاربران', to_row='C3') + excel_description(worksheet, 'B1', f'کاربران', row2='C3') create_header_freez(worksheet, excel_options, 1, 6, 7, height=25, width=20) l = 6