本文整理匯總了Python中course.Course.id方法的典型用法代碼示例。如果您正苦於以下問題:Python Course.id方法的具體用法?Python Course.id怎麽用?Python Course.id使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類course.Course
的用法示例。
在下文中一共展示了Course.id方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: get_course_class_list
# 需要導入模塊: from course import Course [as 別名]
# 或者: from course.Course import id [as 別名]
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: get_course_list
# 需要導入模塊: from course import Course [as 別名]
# 或者: from course.Course import id [as 別名]
def get_course_list(self):
from algorithm.models import School, Department, Class, Prerequisite, Building, Room, Period, Lecturer, ClassInstance, ClassLab, Person, Role, PersonRole
from course import Course
print "This will print out all the courses currently in the database"
self.course_list = []
all_courses = Class.objects.all()
for Class in all_courses:
new_course = Course()
new_course.id = Class.idClass
new_course.name = Class.Class
self.course_list.append(new_course)
self.num_courses += 1
for Course in self.course_list:
Course.print_course()