Пример #1
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()
#Initializes Variables to be used
num = 0
num2 = 0
name = 's'
name2 = 's'
c_id = 0
c_name = 's'


# Test for constructors

# Test constructor with valid information
# Input: ID = 24 Name = Werner
# Expected output: (24, Werner)
p1 = Professor(24, 'Werner')
p1.print_professor()
# Test constructor, and add variables later
p2 = Professor()

# Add variables using manipulation procedure
p2.add_id(42)
p2.add_name('name')

# Test access functions using variables initialized above
num = p1.get_id()
name = p1.get_name()
num2 = p2.get_id()
name2 = p2.get_name()

# Print statment to insure that the variables 
print "Professors name is %s,\n professor's ID is %d" % (name, num)