Шаблон отпуск

This commit is contained in:
iriska-gri committed 2023-11-20 16:49:47 +03:00
1 parent eec21a6871
commit bb97902d95
8 files changed
+134 -25

No files matched your search

+6 -6
View File
@@ -1,13 +1,13 @@
from django.contrib import admin
from .models import *
# class GeneralVacationAdmin(admin.ModelAdmin):
# fields = ('login', 'planned_date', 'count_days', 'type_of_vacation', 'start_work_period', 'end_work_period')
# list_display=('get_name', 'login', 'planned_date', 'count_days', 'type_of_vacation', 'start_work_period', 'end_work_period')
# readonly_fields=('get_name',)
# def get_name(self, obj):
class GeneralVacationAdmin(admin.ModelAdmin):
fields = ('login', 'planned_date', 'count_days', 'type_of_vacation', 'start_work_period', 'end_work_period')
list_display=('get_name', 'login', 'planned_date', 'count_days', 'type_of_vacation', 'start_work_period', 'end_work_period')
readonly_fields=('get_name',)
def get_name(self, obj):
# return obj.user.fio()
return obj.user.fio()
class PlanCalendarAdmin(admin.ModelAdmin):
list_display = ('name', 'start_work_period', 'end_work_period')
+3 -1
View File
@@ -15,7 +15,7 @@ class roundExcel():
pass
def excround(self):
print(self.df )
self.df['tabel'] = self.df['login'].str.split('-', expand = True)[1]+self.df['login'].str.split('-', expand = True)[2]
file_path = 'media/DailyRoundUp.xlsx'
thins = Side(border_style="thin")
@@ -167,6 +167,8 @@ class roundExcel():
PIXELS_PER_CHAR = 7
return (width) / PIXELS_PER_CHAR
def excelvacation(self):
print('helooooooooooooooooooooooooooooooooooooo')
# def excroundread(self):
# file = request.data['dailyfiles']
# ed = pd.read_excel(file)
+4 -4
View File
@@ -1,11 +1,11 @@
from rest_framework import serializers
from .models import *
# class GeneralVacationSerializer(serializers.ModelSerializer):
class GeneralVacationSerializer(serializers.ModelSerializer):
# class Meta:
# model = GeneralVacation
# fields ='__all__'
class Meta:
model = GeneralVacation
fields ='__all__'
class PlanCalendarSerializer(serializers.ModelSerializer):
+7 -1
View File
@@ -47,7 +47,13 @@ class DailyRoundUpAPIView(APIView):
def get(self, request):
user = DictEmployee.objects.using('user_directory').filter(deleted=0).values('login', 'department', 'familyname', 'name', 'parentname')
re = roundExcel(user)
file_path = re.excround()
if request.GET.get("excel") == 'round':
file_path = re.excround()
if request.GET.get("excel") == 'vacation':
file_path = re.excelvacation()