本文整理汇总了Python中courses.models.Course.ccn方法的典型用法代码示例。如果您正苦于以下问题:Python Course.ccn方法的具体用法?Python Course.ccn怎么用?Python Course.ccn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类courses.models.Course
的用法示例。
在下文中一共展示了Course.ccn方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Course
# 需要导入模块: from courses.models import Course [as 别名]
# 或者: from courses.models.Course import ccn [as 别名]
# tempset is now just the unique CCNs. We'll make a Course instance for each by
# getting the first result of a query for Offerings with that CCN
for t in tempset:
o = Offering.objects.filter(ccn=t)[:1]
# o looks like a single object but is actually a queryset consisting of one record.
# To get the first actual object in it, use o[0]
offering = o[0]
print
print offering
# Create a Course record based on that
course = Course()
course.title = offering.title
course.ccn = offering.ccn
course.cstring = offering.cstring
course.units = offering.units
course.type = offering.type
course.description = offering.description
course.restrictions = offering.restrictions
course.save()
# Programs is many to many. Loop through and re-create
for p in offering.programs.all():
course.programs.add(p)
# title = models.CharField(max_length=384)
# ccn = models.CharField('CCN',max_length=384, blank=True)
# cstring = models.ForeignKey(Cstring,verbose_name='Course String',help_text="e.g. J-200, but without the J")
# units = models.IntegerField(choices=constants.UNIT_TYPE_CHOICES)