This commit is contained in:
iriska-gri committed 2023-09-19 16:39:08 +03:00
1 parent 9f350cbbe1
commit d1db19fc58
10 files changed
+55 -1

No files matched your search

BIN
View File
Binary file not shown.
View File
Whitespace-only changes.
+12
View File
@@ -0,0 +1,12 @@
from django.contrib import admin
from .models import *
class GeneralVacationAdmin(admin.ModelAdmin):
fields = ('user', 'planned_date', 'count_days', 'type_of_vacation', 'start_work_period', 'end_work_period')
list_display=('get_name', 'user', 'planned_date', 'count_days', 'type_of_vacation', 'start_work_period', 'end_work_period')
readonly_fields=('get_name',)
def get_name(self, obj):
print(obj.user.fio(), '----------------obj.user.fio()')
return obj.user.fio()
admin.site.register(GeneralVacation, GeneralVacationAdmin)
+8
View File
@@ -0,0 +1,8 @@
from django.apps import AppConfig
class GeneralVacationConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'general_vacation'
verbose_name = "Общий график отпусков"
+26
View File
@@ -0,0 +1,26 @@
from django.db import models
from django.conf import settings
from userauth.models import DictEmployee
class GeneralVacation(models.Model):
CHOICES = (
('os', 'Осн'),
('nd', 'Доп н/д'),
('vl', 'Доп в/л'),
)
user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.PROTECT, verbose_name='Сотрудник')
planned_date = models.DateField(verbose_name='Запланированная дата')
count_days = models.IntegerField(verbose_name='Кол-во дней', default=0, blank=True)
type_of_vacation = models.CharField(max_length=300, choices = CHOICES, verbose_name='Тип отпуска')
start_work_period = models.DateField(verbose_name='Начало рабочего периода')
end_work_period = models.DateField(verbose_name='Конец рабочего периода')
class Meta:
verbose_name = "График отпусков"
verbose_name_plural = "График отпусков"
def __str__(self):
return str(self.user)
def department(self):
return DictEmployee.objects.using('user_directory').get(login=self.username).department
+3
View File
@@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.
View File
Whitespace-only changes.
+3
View File
@@ -0,0 +1,3 @@
from django.shortcuts import render
# Create your views here.
+2 -1
View File
@@ -58,7 +58,8 @@ INSTALLED_APPS = [
'corsheaders',
'watcher.apps.WatcherConfig',
'userauth.apps.UserauthConfig',
'feedback.apps.FeedbackConfig'
'feedback.apps.FeedbackConfig',
'general_vacation.apps.GeneralVacationConfig'
]
+1
View File
@@ -63,5 +63,6 @@ urlpatterns = [
path("api/navigation/",include("navigation.urls")),
path('api/watcher/', include('watcher.urls')),
path('api/feedback/', include('feedback.urls')),
# path('api/general_vacation/', include('general_vacation.urls')),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)