Пример #1
0
 def test_get_all_without_courses(self):
     events = factories.EventFactory.create_batch(random.randint(50, 100))
     events.append(self.event)
     get_all_wo_courses_res = Event.get_all_without_courses()
     events_wo_courses = [x for x in events if x.type != Event.TYPE_CLASS]
     self.assertEqual(len(events_wo_courses), len(get_all_wo_courses_res))
     get_all_res_pk = [x.pk for x in get_all_wo_courses_res]
     for i in range(0, len(events_wo_courses)):
         self.assertTrue(events_wo_courses[i].pk in get_all_res_pk)
Пример #2
0
def reservations(request):
    events = EventFilter(request.GET, queryset=Event.get_all_without_courses())
    qs = Paginator(events.qs, 10).get_page(request.GET.get('page', 1))
    title = 'Zarządzaj rezerwacjami'
    return TemplateResponse(request, 'schedule/reservations.html', locals())