dr
This commit is contained in:
1 parent
f46c3f6aaa
commit
99145b3b9c
7 files changed
+67
-31
No files matched your search
+36
-10
@@ -4,27 +4,53 @@ from rest_framework.response import Response
|
||||
from rest_framework.views import APIView
|
||||
from .renderers import UserJSONRenderer
|
||||
from userauth.models import *
|
||||
from navigation.models import *
|
||||
from userauth.serializers import *
|
||||
from .models import *
|
||||
from .serializers import *
|
||||
import pandas as pd
|
||||
|
||||
|
||||
class testView(APIView):
|
||||
|
||||
def get(self, request):
|
||||
queryset = DictEmployee.objects.using('user_directory').get(login='9966-00-125')
|
||||
|
||||
# fil = OrderResponsibility.objects.using('user_directory').filter(id__lt=15)
|
||||
|
||||
# responsibility = OrderResponsibilityEmployee.objects.using('user_directory').filter(id_dict_employee=queryset.id)
|
||||
# h = []
|
||||
# for x in responsibility:
|
||||
# h.append(FileResponsiblitySerializer(x.id_order_responsibility.get_resp_files.all(), many=True).data)
|
||||
ser = CardUserSerializer(queryset)
|
||||
from datetime import date
|
||||
|
||||
manbrd = DictEmployee.objects.using('user_directory').filter(birthdate__month=date.today().month)
|
||||
if len(manbrd) > 0 :
|
||||
nowday= manbrd.filter(birthdate__day=date.today().day)
|
||||
|
||||
brdimage = BirthdayImage.objects.order_by("?")[:len(nowday)+1]
|
||||
|
||||
|
||||
allbirthday = {
|
||||
"title":'Дни рождения в это месяце ',
|
||||
"text": "\n".join([f"{x.birthdate} - {x.fio}" for x in manbrd]),
|
||||
"link": "/media/"+str(brdimage[0].img),
|
||||
"published": 'true',
|
||||
|
||||
"sender": "/media/default/dr.png",
|
||||
}
|
||||
|
||||
|
||||
if len(nowday) > 0 :
|
||||
|
||||
|
||||
brdtext = BirthdayText.objects.order_by("?")[:len(nowday)]
|
||||
# print( brdtext[].text, '=====================================')
|
||||
birthday = []
|
||||
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",
|
||||
})
|
||||
|
||||
|
||||
return Response(ser.data)
|
||||
return Response(birthday)
|
||||
# from .serializers import RegistrationSerializer
|
||||
|
||||
# class RegistrationAPIView(APIView):
|
||||
|
||||
Binary file not shown.
@@ -23,7 +23,7 @@
|
||||
eager
|
||||
>
|
||||
|
||||
<my-helper :pretext="x"/>
|
||||
<!-- <my-helper :pretext="x"/> -->
|
||||
|
||||
<v-container
|
||||
fill-height
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 115 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 188 KiB |
File renamed without changes.
|
Before Width: | Height: | Size: 227 KiB After Width: | Height: | Size: 227 KiB |
+30
-20
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user