當前位置: 首頁>>代碼示例>>Python>>正文


Python Member.labtut_section方法代碼示例

本文整理匯總了Python中coredata.models.Member.labtut_section方法的典型用法代碼示例。如果您正苦於以下問題:Python Member.labtut_section方法的具體用法?Python Member.labtut_section怎麽用?Python Member.labtut_section使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在coredata.models.Member的用法示例。


在下文中一共展示了Member.labtut_section方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: ensure_member

# 需要導入模塊: from coredata.models import Member [as 別名]
# 或者: from coredata.models.Member import labtut_section [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.labtut_section方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。