Добавление информирования отпуска

This commit is contained in:
iriska-gri committed 2023-09-28 16:12:07 +03:00
1 parent 8593612059
commit a78f9eea3b
25 files changed
+91 -34

No files matched your search

BIN
View File
Binary file not shown.
+2
View File
@@ -5,6 +5,8 @@ from django.db.models import Avg
class BaseCriteriaAdmin(admin.ModelAdmin):
list_display=('name', 'rating')
class RatingStatusInline(admin.TabularInline):
model = RatingStatus
fields = ( 'crit', 'rating')
+1 -1
View File
@@ -84,7 +84,7 @@ export default {
// console.log(info.event.extendedProps);
// {description: "Lecture", department: "BioChemistry"}
// },
aspectRatio: 3,
aspectRatio: 1,
multiMonthMaxColumns: 2,
displayEventEnd: true,
height: '100%',
+31 -12
View File
@@ -1,14 +1,15 @@
<template>
<!-- -->
<v-carousel
cycle
interval="7000"
interval="10000"
cover
height="450"
hide-delimiters
hide-delimiter-background
show-arrows="hover"
color="white"
cycle
@@ -17,13 +18,12 @@
<v-carousel-item
v-for="(x, i) in carous" :key="i"
:src="`${burl}${x.link}`"
cover
eager
>
<!-- <my-helper :pretext = 'x'/> -->
<v-container
fill-height
fluid
@@ -31,15 +31,16 @@
class="flex-column h-100 d-flex"
>
<v-card class="bgCard h-100 d-flex flex-column">
<v-card-title class="ma-2 text-h3 text-uppercase titles text-text_carous py-6 flex-column">
<v-card-title class="ma-2 text-h3 text-uppercase titles text-text_carous py-5 flex-column">
<v-row>
<v-col class="pa-0">{{x.title}} </v-col>
<v-col class="pa-0 pl-1 align-self-center">{{x.title}} </v-col>
<!-- {{ burl }} {{ x.sender }} -->
<v-col class="flex-grow-0 pa-0 pr-1">
<v-img
width="50"
:aspect-ratio="1"
:src="imageSrcgrupp"
:src="`${burl}${x.sender}`"
cover
/>
</v-col>
@@ -47,9 +48,22 @@
</v-card-title>
<v-card-text class="ml-2 mb-2 text-black w-50 flex-grow-0 py-3 text-text_carous text-h5 bgText overflow-auto font-weight-medium">
{{x.text}}
<v-card-text class="ml-2 mb-0 mb-2 w-50 flex-grow-0 pb-3 text-h6 bgText overflow-auto ">
<v-textarea
class="text-text_carous mt-n3 text-black textareas pt-2 font-weight-medium"
:model-value=x.text
variant='plain'
readonly
auto-grow
rows="1"
hide-details
/>
</v-card-text>
</v-card>
@@ -97,7 +111,7 @@ export default {
.bgText {
background: #ffffffb0;
line-height: 3.0rem!important;
line-height: 2.1rem!important;
}
@@ -105,4 +119,9 @@ export default {
font-family: cursive !important;
background: #ffffff8c;
}
.textareas .v-field__input {
font-size: 1.3em!important;
}
</style>
Binary file not shown.

After

Width:  |  Height:  |  Size: 593 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 199 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 346 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 346 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 346 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 593 KiB

After

Width:  |  Height:  |  Size: 227 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 345 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 207 KiB

+24 -2
View File
@@ -1,5 +1,5 @@
from django.contrib import admin
from django.utils.safestring import mark_safe
from .models import *
@@ -12,15 +12,37 @@ class NewsAdmin(admin.ModelAdmin):
super().save_model(request, obj, form, change)
class CarouselsAdmin(admin.ModelAdmin):
list_display=('title', 'cdate', 'enddate', 'get_html_photo', 'link','published', 'sender')
readonly_fields=('get_html_photo',)
list_editable=('link','published', 'cdate', 'enddate', 'sender')
list_filter=('cdate', 'enddate','published')
fields=(('title', 'sender'), 'published', 'text', ('cdate', 'enddate'), ('link','get_html_photo'))
def save_model(self, request, obj, form, change):
if (request.user.username != 'admin') :
obj.author = request.user
else :
obj.author = User.objects.get(id=15)
super().save_model(request, obj, form, change)
def get_html_photo(self, object):
if object.link:
return mark_safe(f"<img src='{object.link.url}' width=50>")
get_html_photo.short_description="Изображение"
class BaseSenderAdmin(admin.ModelAdmin):
list_display=('name', 'img')
list_display=('name', 'get_html_photo', 'img')
list_editable=('img',)
fields=('name', ('img', 'get_html_photo'))
readonly_fields=('get_html_photo',)
def get_html_photo(self, object):
if object.img:
return mark_safe(f"<img src='{object.img.url}' width=50>")
get_html_photo.short_description="Изображение"
admin.site.register(Links)
admin.site.register(News,NewsAdmin)
+2
View File
@@ -5,3 +5,5 @@ class NavigationConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'navigation'
verbose_name = "Навигация"
+15 -11
View File
@@ -3,7 +3,16 @@ from accounts.models import *
# Create your models here.
from django.conf import settings
class BaseSender(models.Model):
name = models.CharField(verbose_name='Название', max_length=150, blank=True, db_index=True)
img = models.ImageField(verbose_name='Картинка', null=True, blank=True, upload_to='senderimage')
class Meta:
verbose_name = "Справочник - Тематика"
verbose_name_plural = "Справочник - Тематика"
def __str__(self):
return str(self.name)
class Links(models.Model):
name = models.CharField(db_index=True, max_length=255, verbose_name='Заголовок')
@@ -37,11 +46,13 @@ class News(models.Model):
class Carousels(models.Model):
title=models.CharField( max_length=255, verbose_name='Заголовок')
text= models.TextField(null=True, verbose_name='Сообщение')
cdate =models.DateTimeField(auto_now_add=True, verbose_name='Дата создания')
cdate =models.DateTimeField(default=datetime.now(), verbose_name='Дата создания')
author = models.ForeignKey(settings.AUTH_USER_MODEL, editable=False, on_delete=models.PROTECT, verbose_name='Автор новости')
link = models.ImageField(upload_to='newsimage/%Y/%m/%d', null=True, default="newsimage/default.jpg", verbose_name='Картинка')
published = models.BooleanField(default=False, verbose_name='Опубликован')
enddate = models.DateTimeField(auto_now=True, verbose_name='Дата снятия с публикации')
enddate = models.DateTimeField(default=datetime.now().replace(hour=23,minute=0,second=0,microsecond=0) + timedelta(days=7), verbose_name='Дата снятия с публикации')
sender = models.ForeignKey(BaseSender, on_delete=models.PROTECT, related_name='get_sender', verbose_name='Тематика')
class Meta:
verbose_name = "Карусель новостей"
@@ -49,14 +60,7 @@ class Carousels(models.Model):
def __str__(self):
return str(self.title)
class BaseSender(models.Model):
name = models.CharField(verbose_name='Название', max_length=150, blank=True, db_index=True)
img = models.ImageField(verbose_name='Картинка', null=True, blank=True, upload_to='senderimage')
class Meta:
verbose_name = "Справочник - Тематика"
verbose_name_plural = "Справочник - Тематика"
def __str__(self):
return str(self.name)
+15 -7
View File
@@ -6,6 +6,8 @@ from rest_framework.permissions import AllowAny, IsAuthenticated
from rest_framework.response import Response
from .serializers import *
from userauth.models import *
from general_vacation.models import *
from django.db.models import Q
class LinkAPIView(ListAPIView):
permission_classes = (AllowAny,)
@@ -46,18 +48,24 @@ class CarouselsAPIView(ListAPIView):
def get(self, request):
queryset = Carousels.objects.filter(published=True).order_by('pk')
# serializer = self.serializer_class(queryset, many=True)
# print(serializer.data)
Carousels.objects.filter(Q(cdate__lt=datetime.now()) & ~Q(pk=4)).update(published=True)
Carousels.objects.filter(Q(enddate__lt=datetime.now()) & ~Q(pk=4)).update(published=False)
queryset = Carousels.objects.filter(published=True).order_by('-cdate')
vacation = GeneralVacation.objects.filter(user_id=15)
print(vacation, self.request, 'vfg------------------')
result = []
for x in queryset:
for x in queryset:
a=model_to_dict(x)
a['link']= str(x.link.url)
a['show'] = False
a['author'] = model_to_dict(DictEmployee.objects.using('user_directory').get(login=x.author.username))
result.append(a)
if x.sender.img:
a['sender'] = str(x.sender.img.url)
else:
a['sender'] = None
result.append(a)
return Response(result)
+1 -1
View File
@@ -19,7 +19,7 @@ class Counter(ListAPIView):
# return Response(qs)
def post(self, request):
print(request.data['user__id'])
# print(request.data['user__id'])
if request.data['user__id'] is not None:
# print("sdddddd")
watch,create = CountVisitor.objects.get_or_create(user = User(id=request.data['user__id']),page=request.data['page'], visitdate=date.today())