def __init__(self, user): super(TeacherSettingsBody, self).__init__(user) self.subjectrooms = [] for subjectroom in user.subjects_managed_set.all(): self.subjectrooms.append(get_subjectroom_label(subjectroom)) self.classrooms = [] for classroom in user.classes_managed_set.all(): self.classrooms.append(get_classroom_label(classroom))
def __init__(self, user): super(StudentSettingsBody, self).__init__(user) classroom = user.classes_enrolled_set.get( ) # user should be enrolled in 1 class only self.classroom = get_classroom_label(classroom) self.class_teacher = get_user_label(classroom.classTeacher) self.parents = [ get_user_label(home.parent) for home in user.homes_enrolled_set.all() ]
def __init__(self, user): super(AdminSettingsBody, self).__init__(user) school_profile = user.userinfo.school.schoolprofile self.focusrooms = school_profile.focus self.sms_notifications = school_profile.pylon self.board = user.userinfo.school.board.name self.classrooms = [] for classroom in ClassRoom.objects.filter(school=user.userinfo.school): self.classrooms.append(get_classroom_label(classroom))
def __init__(self, student, parent_form): super(ParentIdBody, self).__init__(parent_form, InkUrlNames.PARENT_ID.name) self.parent_form = parent_form self.student_id = student.pk self.student_name = get_user_label(student) self.student_class = get_classroom_label(student.classes_enrolled_set.get()) self.flagged = student.dossier.flagged self.email = student.email self.phone = student.dossier.phone self.secondary_email = student.dossier.secondaryEmail self.secondary_phone = student.dossier.secondaryPhone
def get_target_label(self): if self.content_type == ContentType.objects.get_for_model(User): return get_user_label(self.content_object) elif self.content_type == ContentType.objects.get_for_model(School): return self.content_object.name elif self.content_type == ContentType.objects.get_for_model(ClassRoom): return get_classroom_label(self.content_object) elif self.content_type == ContentType.objects.get_for_model( SubjectRoom): return get_subjectroom_label(self.content_object) else: raise InvalidContentTypeError(self.content_type)
def __init__(self, classteacher, *args, **kwargs): super(ClassSubjectAnnouncementForm, self).__init__(*args, **kwargs) options_list = [] for subjectroom in SubjectRoom.objects.filter(teacher=classteacher): options_list.append( (ClassSubjectAnnouncementForm.CLASSROOM_ID_PREFIX + str(subjectroom.pk), get_subjectroom_label(subjectroom))) for classroom in ClassRoom.objects.filter(classTeacher=classteacher): options_list.append( (ClassSubjectAnnouncementForm.SUBJECTROOM_ID_PREFIX + str(classroom.pk), get_classroom_label(classroom))) self.fields['target'] = forms.ChoiceField( choices=options_list, widget=ChosenNoSearchSelect, help_text=ANNOUNCEMENT_TARGET_HELP_TEXT)
def __init__(self, child): self.name = get_user_label(child) classroom = child.classes_enrolled_set.get() self.classroom = get_classroom_label(classroom) self.classteacher = get_user_label(classroom.classTeacher)
def __init__(self, classroom, subjectroom_rows): self.classroom = get_classroom_label(classroom) self.classteacher = get_user_label(classroom.classTeacher) self.subjectroom_rows = subjectroom_rows