This commit is contained in:
iriska-gri committed 2023-11-16 16:59:24 +03:00
1 parent 290d35d060
commit f46c3f6aaa
11 files changed
+138 -89

No files matched your search

+30 -10
View File
@@ -8,7 +8,9 @@ from .serializers import *
from userauth.models import *
from general_vacation.models import *
from django.db.models import Q, Count
# import datetime
from userauth.models import *
from userauth.serializers import *
from datetime import date
class LinkAPIView(ListAPIView):
permission_classes = (AllowAny,)
@@ -98,15 +100,7 @@ class CarouselsAPIView(ListAPIView):
queryset = Carousels.objects.filter(published=True, cdate__lte=datetime.now(), enddate__gte=datetime.now()).order_by('-cdate')
# vacation = GeneralVacation.objects.filter(user_id=request.user.id, planned_date__lte=datetime.now() + timedelta(days=7))
# print(vacation, '-----------------')
# if vacation:
# Carousels.objects.update(published=True)
# else:
# Carousels.objects.filter().update(published=False)
# Carousels.objects.update_or_create(id=request.data['nowcomment']['id'],user_id=15, defaults={'comment':request.data['nowcomment']['comment'], 'time_create':datetime.datetime.now()})
result = []
for x in queryset:
a=model_to_dict(x)
@@ -119,6 +113,32 @@ class CarouselsAPIView(ListAPIView):
a['sender'] = None
result.append(a)
manbrd = DictEmployee.objects.using('user_directory').filter(birthdate__month=date.today().month)
brdimage = BirthdayImage.objects.order_by("?").first()
print(manbrd, '---------------------------birthdayimage')
birthday = {
"title":'Вася тупкин',
"text": "С др крч? \n жопа огурца",
"link": "/media/"+str(brdimage.img),
"published": 'true',
"enddate": "2500-10-05T20:00:00Z",
"sender": "/media/senderimage/dr.png",
}
birthday = {
"title":'В этом месяце',
"text": "18 января Вася тупин? \n ываб ка",
"link": "/media/"+str(brdimage.img),
"published": 'true',
"enddate": "2500-10-05T20:00:00Z",
"sender": "/media/senderimage/dr.png",
}
result.append(birthday)
return Response(result)