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


Python CertificateGenerationConfiguration.save方法代码示例

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


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

示例1: enable_auto_certificate_generation

# 需要导入模块: from certificates.models import CertificateGenerationConfiguration [as 别名]
# 或者: from certificates.models.CertificateGenerationConfiguration import save [as 别名]
def enable_auto_certificate_generation(apps, schema_editor):
    """ add an enabled CertificateGenerationConfiguration and
        enable student-generated certificates on all courses
        by setting the enabled bit
    """
    # not sure why I'm not getting the certificates app, so we'll force it
    from certificates.models import CertificateGenerationConfiguration, CertificateGenerationCourseSetting
    apps.load_app('certificates')
    apps.register_models('certificates', CertificateGenerationConfiguration)
    apps.register_models('certificates', CertificateGenerationCourseSetting)
    CertificateGenerationConfiguration = apps.get_model("certificates", "CertificateGenerationConfiguration")
    ccg = CertificateGenerationConfiguration(enabled=1)  # configuration model.  just add a new one
    ccg.save()
    
    CertificateGenerationCourseSetting = apps.get_model("certificates", "CertificateGenerationCourseSetting")
    courses = modulestore().get_courses()
    for course in courses:
        key = course.location.course_key
        ccs, created = CertificateGenerationCourseSetting.objects.get_or_create(course_key=key, enabled=1)
        if not created:
        	ccs.enabled = 1
        	ccs.save()
开发者ID:ISCLC,项目名称:iscedxreports,代码行数:24,代码来源:0004_auto_20160412_2240.py


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