Пример #1
0
 def get_context_data(self, *args, **kwargs):
     context = super(SetupStudentCoursePrefListView, self).get_context_data(*args, **kwargs)
     students = get_all_students(self.setup)
     courses = Course.objects.filter(setupcourse__setup=self.setup).distinct()
     prefs = SetupStudentCoursePref.objects.filter(setup=self.setup)
     context["students"] = students
     context["courses"] = courses
     context["prefs"] = dict([((p.course_id, p.student_id), p) for p in prefs])
     return context
Пример #2
0
 def get_queryset(self):
     setup = get_object_or_404(Setup, pk=self.kwargs['pks'])
     return get_all_students(setup)