Esempio n. 1
0
 def __init__(self, instance=None, *args, **kwargs):
     if instance is None:
         instance = Lesson.objects.get(pk=kwargs['initial']['lesson'])
     lesson = instance
     self.instance = instance
     lesson_assign_attendees.send(sender=self, lesson=lesson)
     
     initial = kwargs.get('initial', {}); kwargs['initial'] = initial
     if 'real_classroom' not in initial: 
         initial['real_classroom'] = instance.real_classroom.pk if instance.realized else instance.classroom.pk
     if 'real_lector' not in initial: 
         initial['real_lector'] = instance.real_lector.pk if instance.realized else instance.course.lector.pk
     if 'real_content' not in initial and instance.realized: 
         initial['real_content'] = instance.real_content
     if 'real_start' not in initial: 
         initial['real_start'] = instance.real_start if instance.realized else instance.start
     if 'real_end' not in initial: 
         initial['real_end'] = instance.real_end if instance.realized else instance.end
     if 'lesson_attendees' not in initial: 
         initial['lesson_attendees'] = [a.pk for a in instance.lessonattendee_set.all() if a.present]
     
     super(LessonRealizedForm1, self).__init__(*args, **kwargs)
     self.fields['lesson'].initial = lesson.pk
     classroom_buildings(self.fields['real_classroom'])
     self.fields['lesson_attendees'].queryset = lesson.lessonattendee_set.all() 
Esempio n. 2
0
    def __init__(self, *args, **kwargs):
        date_required = kwargs.get('date_required', False)
        if 'date_required' in kwargs:
            kwargs.pop('date_required')
        
        super(LessonSearchForm, self).__init__(*args, **kwargs)
        classroom_buildings(self.fields['classroom'])

        self.fields['start'].required = date_required
        self.fields['end'].required = date_required
Esempio n. 3
0
 def __init__(self, *args, **kwargs):
     super(LessonRealizedForm, self).__init__(*args, **kwargs)
     classroom_buildings(self.fields['real_classroom'])
Esempio n. 4
0
 def __init__(self, *args, **kwargs):
     super(LessonPlanForm, self).__init__(*args, **kwargs)
     classroom_buildings(self.fields['classroom'])
Esempio n. 5
0
 def __init__(self, *args, **kwargs):
     super(ChooseClassroomForm, self).__init__(*args, **kwargs)
     classroom_buildings(self.fields['classroom'])