This commit is contained in:
iriska-gri committed 2023-11-17 11:07:44 +03:00
1 parent f46c3f6aaa
commit 99145b3b9c
7 files changed
+67 -31

No files matched your search

+30 -20
View File
@@ -114,31 +114,41 @@ class CarouselsAPIView(ListAPIView):
result.append(a)
manbrd = DictEmployee.objects.using('user_directory').filter(birthdate__month=date.today().month)
brdimage = BirthdayImage.objects.order_by("?").first()
print(manbrd, '---------------------------birthdayimage')
if len(manbrd) > 0 :
nowday= manbrd.filter(birthdate__day=date.today().day)
brdimage = BirthdayImage.objects.order_by("?")[:len(nowday)+1]
birthday = {
"title":'Вася тупкин',
"text": "С др крч? \n жопа огурца",
"link": "/media/"+str(brdimage.img),
allbirthday = {
"title":'Дни рождения',
"text": "в этом месяце:\n"+"\n".join([f"{x.birthdate.strftime('%d')} - {x.fio}" for x in manbrd]),
"link": "/media/"+str(brdimage[0].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",
"sender": "/media/default/dr.png",
}
birthday = []
if len(nowday) > 0 :
brdtext = BirthdayText.objects.order_by("?")[:len(nowday)]
for k in nowday:
birthday.append({
"title":'Поздравляем!',
"text": f"{k.fio} {brdtext[0].text}",
"link": "/media/"+str(brdimage[0].img),
"published": 'true',
"sender": "/media/default/dr.png",
})
result.append(birthday)
result = [allbirthday] + birthday+ result
return Response(result)