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


Python Member.official_grade方法代码示例

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


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

示例1: ensure_member

# 需要导入模块: from coredata.models import Member [as 别名]
# 或者: from coredata.models.Member import official_grade [as 别名]
def ensure_member(person, offering, role, cred, added_reason, career, labtut_section=None, grade=None, sched_print_instr=None):
    """
    Make sure this member exists with the right properties.
    """
    if person.emplid in [200133427, 200133425, 200133426]:
        # these are: ["Faculty", "Tba", "Sessional"]. Ignore them: they're ugly.
        return
    
    m_old = Member.objects.filter(person=person, offering=offering)

    if len(m_old)>1:
        # may be other manually-created dropped entries: that's okay.
        m_old = Member.objects.filter(person=person, offering=offering).exclude(role="DROP")
        if len(m_old)>1:
            raise KeyError("Already duplicate entries: %r" % (m_old))
        elif len(m_old)==0:
            m_old = Member.objects.filter(person=person, offering=offering)
        
    if len(m_old)>=1:
        m = m_old[0]
    else:
        m = Member(person=person, offering=offering)

    m.role = role
    m.labtut_section = labtut_section
    m.credits = cred
    m.added_reason = added_reason
    m.career = career

    # record official grade if we have it (and might need it)
    if has_letter_activities(m.offering):
        m.official_grade = grade or None
    else:
        m.official_grade = None

    # record sched_print_instr status for instructors
    if role=='INST' and sched_print_instr:
        m.config['sched_print_instr'] = sched_print_instr == 'Y'

    # if offering is being given lab/tutorial sections, flag it as having them
    # there must be some way to detect this in ps_class_tbl, but I can't see it.
    if labtut_section and not offering.labtut():
        offering.set_labtut(True)
        offering.save_if_dirty()
    
    m.save_if_dirty()
    return m
开发者ID:sfu-fas,项目名称:coursys,代码行数:49,代码来源:importer.py


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