コード例 #1
0
    def get_course_class_list(self):        
        from algorithm.models import School, Department, Class, Prerequisite, Building, Room, Period, Lecturer, ClassInstance, ClassLab, Person, Role, PersonRole 
        from course_class import CourseClass
    # This section takes values from the database and stores them in course clas list 
        print "This will print out all of the course classes currently in the database"
        self.classes_list = []

        all_course_class = ClassInstance.objects.all()
        for ClassInstance in all_course_class:       

            lecturer = ClassInstance.idLecturer
            new_prof = Professor()
            new_prof.name = lecturer.Name
            new_prof.id = lecturer.idLecturer

            Class = ClassInstance.idClass
            new_course = Course()
            new_course.id = Class.idClass
            new_course.name = Class.Class
            
            
            


            new_course_class = CourseClass()
            new_course_class.professor = new_prof
            new_course_class.course = new_course
            new_course_class.duration = 1
            new_course_class.lab = False
            new_course_class.id = ClassInstance.idClassInstance
            self.classes_list.append(new_course_class)
            self.num_classes += 1

        for course_class in self.classes_list:
            print "(Professer: %s Course: %s Durration: %d Lab: %d)" % (course_class.professor, course_class.course, course_class.duration, course_class.lab)
コード例 #2
0
    def get_prof_list(self):
        from algorithm.models import School, Department, Class, Prerequisite, Building, Room, Period, Lecturer, ClassInstance, ClassLab, Person, Role, PersonRole 
        from professor import Professor
        
        print "This will print out all of the professors currently in the database"
        self.prof_list = []
    
        all_lecturers = Lecturer.objects.all()
        
        for Lecturer in all_lecturers:
            print "Lecturer name = %s, Lecturer ID = %d" % (Lecturer.Name, Lecturer.idLecturer)
            new_prof = Professor()
            new_prof.name = Lecturer.Name
            new_prof.id = Lecturer.idLecturer
#            new_prof.course_list = course_list
            self.prof_list.append(new_prof)
            self.num_professors += 1

        for Professor in self.prof_list:
            Professor.print_professor()