当前位置: 首页>>代码示例>>Python>>正文


Python Course.units方法代码示例

本文整理汇总了Python中courses.models.Course.units方法的典型用法代码示例。如果您正苦于以下问题:Python Course.units方法的具体用法?Python Course.units怎么用?Python Course.units使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在courses.models.Course的用法示例。


在下文中一共展示了Course.units方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Course

# 需要导入模块: from courses.models import Course [as 别名]
# 或者: from courses.models.Course import units [as 别名]
# 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)
    # type = models.IntegerField(choices=constants.COURSE_TYPE_CHOICES)
    # description = models.TextField()
开发者ID:shacker,项目名称:djcc,代码行数:33,代码来源:splitcourses.py


注:本文中的courses.models.Course.units方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。