dr
This commit is contained in:
1 parent
f46c3f6aaa
commit
99145b3b9c
7 files changed
+62
-26
No files matched your search
+34
-8
@@ -4,27 +4,53 @@ from rest_framework.response import Response
|
|||||||
from rest_framework.views import APIView
|
from rest_framework.views import APIView
|
||||||
from .renderers import UserJSONRenderer
|
from .renderers import UserJSONRenderer
|
||||||
from userauth.models import *
|
from userauth.models import *
|
||||||
|
from navigation.models import *
|
||||||
from userauth.serializers import *
|
from userauth.serializers import *
|
||||||
from .models import *
|
from .models import *
|
||||||
from .serializers import *
|
from .serializers import *
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
|
|
||||||
|
|
||||||
class testView(APIView):
|
class testView(APIView):
|
||||||
|
|
||||||
def get(self, request):
|
def get(self, request):
|
||||||
queryset = DictEmployee.objects.using('user_directory').get(login='9966-00-125')
|
from datetime import date
|
||||||
|
|
||||||
# fil = OrderResponsibility.objects.using('user_directory').filter(id__lt=15)
|
manbrd = DictEmployee.objects.using('user_directory').filter(birthdate__month=date.today().month)
|
||||||
|
if len(manbrd) > 0 :
|
||||||
|
nowday= manbrd.filter(birthdate__day=date.today().day)
|
||||||
|
|
||||||
# responsibility = OrderResponsibilityEmployee.objects.using('user_directory').filter(id_dict_employee=queryset.id)
|
brdimage = BirthdayImage.objects.order_by("?")[:len(nowday)+1]
|
||||||
# h = []
|
|
||||||
# for x in responsibility:
|
|
||||||
# h.append(FileResponsiblitySerializer(x.id_order_responsibility.get_resp_files.all(), many=True).data)
|
|
||||||
ser = CardUserSerializer(queryset)
|
|
||||||
|
|
||||||
|
|
||||||
|
allbirthday = {
|
||||||
|
"title":'Дни рождения в это месяце ',
|
||||||
|
"text": "\n".join([f"{x.birthdate} - {x.fio}" for x in manbrd]),
|
||||||
|
"link": "/media/"+str(brdimage[0].img),
|
||||||
|
"published": 'true',
|
||||||
|
|
||||||
return Response(ser.data)
|
"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(birthday)
|
||||||
# from .serializers import RegistrationSerializer
|
# from .serializers import RegistrationSerializer
|
||||||
|
|
||||||
# class RegistrationAPIView(APIView):
|
# class RegistrationAPIView(APIView):
|
||||||
|
|||||||
Binary file not shown.
@@ -23,7 +23,7 @@
|
|||||||
eager
|
eager
|
||||||
>
|
>
|
||||||
|
|
||||||
<my-helper :pretext="x"/>
|
<!-- <my-helper :pretext="x"/> -->
|
||||||
|
|
||||||
<v-container
|
<v-container
|
||||||
fill-height
|
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 |
+27
-17
@@ -114,31 +114,41 @@ class CarouselsAPIView(ListAPIView):
|
|||||||
result.append(a)
|
result.append(a)
|
||||||
|
|
||||||
manbrd = DictEmployee.objects.using('user_directory').filter(birthdate__month=date.today().month)
|
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]
|
||||||
|
|
||||||
brdimage = BirthdayImage.objects.order_by("?").first()
|
allbirthday = {
|
||||||
print(manbrd, '---------------------------birthdayimage')
|
"title":'Дни рождения',
|
||||||
|
"text": "в этом месяце:\n"+"\n".join([f"{x.birthdate.strftime('%d')} - {x.fio}" for x in manbrd]),
|
||||||
birthday = {
|
"link": "/media/"+str(brdimage[0].img),
|
||||||
"title":'Вася тупкин',
|
|
||||||
"text": "С др крч? \n жопа огурца",
|
|
||||||
"link": "/media/"+str(brdimage.img),
|
|
||||||
"published": 'true',
|
"published": 'true',
|
||||||
"enddate": "2500-10-05T20:00:00Z",
|
|
||||||
"sender": "/media/senderimage/dr.png",
|
"sender": "/media/default/dr.png",
|
||||||
}
|
}
|
||||||
birthday = {
|
birthday = []
|
||||||
"title":'В этом месяце',
|
if len(nowday) > 0 :
|
||||||
"text": "18 января Вася тупин? \n ываб ка",
|
|
||||||
"link": "/media/"+str(brdimage.img),
|
|
||||||
|
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',
|
"published": 'true',
|
||||||
"enddate": "2500-10-05T20:00:00Z",
|
"sender": "/media/default/dr.png",
|
||||||
"sender": "/media/senderimage/dr.png",
|
})
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
result.append(birthday)
|
|
||||||
|
result = [allbirthday] + birthday+ result
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return Response(result)
|
return Response(result)
|
||||||
|
|||||||
Reference in new issue
Block a user