Отражение данных из БД
Без периодичности
This commit is contained in:
1 parent
79a62561c5
commit
efeca2d1ef
10 files changed
+228
-65
No files matched your search
@@ -7,17 +7,20 @@ from rest_framework.response import Response
|
||||
class CalendarEventsAPIView(APIView):
|
||||
|
||||
def get(self, request):
|
||||
|
||||
|
||||
return Response('ku')
|
||||
cal = CalendarEventsName.objects.all()
|
||||
|
||||
return Response(CalendarEventsNameSerializer(cal, many=True).data)
|
||||
|
||||
def post(self, request):
|
||||
|
||||
""" Записываем или обновляем глобальное название в таблицу, если есть участники так же пишем в соотвтв. таблицу с привязкой к событию.
|
||||
Добавляем или удаляяем запись о событии
|
||||
"""
|
||||
namecalendar, created = CalendarEventsName.objects.update_or_create(name=request.data['participants'],
|
||||
defaults = {'name':request.data['participants'], 'author_id': self.request.user.id})
|
||||
# print(self.request.user.id, '111111111111111111111111111111111111111111111111')
|
||||
|
||||
|
||||
for cal in request.data['calendar']:
|
||||
|
||||
CalendarEvents.objects.update_or_create(calendarname_id=namecalendar.pk,
|
||||
name = cal['summary'],
|
||||
author_id = self.request.user.id,
|
||||
@@ -27,9 +30,18 @@ class CalendarEventsAPIView(APIView):
|
||||
'enddate': cal['end'],
|
||||
'author_id': self.request.user.id,
|
||||
'place': cal['location'],
|
||||
'calendarname_id': namecalendar.pk
|
||||
'calendarname_id': namecalendar.pk,
|
||||
'frequency': 'repeat: {weekdays: [5] }'
|
||||
})
|
||||
# print(cal['summary'],'1---------------------------')
|
||||
# print(cal['description'],'2---------------------------')
|
||||
return Response('ru')
|
||||
# Create your views here.
|
||||
# if len(cal['attendees']) > 0 :
|
||||
# for player in cal['attendees']:
|
||||
# print(player, '5555555555555')
|
||||
# ParticipantsEvent.objects.update_or_create(participant=player,
|
||||
# event=envent.pk,
|
||||
# defaults= {'participant':player,
|
||||
# 'event':envent.pk
|
||||
|
||||
# })
|
||||
|
||||
|
||||
return Response('ru')
|
||||
Reference in new issue
Block a user