本文整理汇总了Python中coredata.models.Member.career方法的典型用法代码示例。如果您正苦于以下问题:Python Member.career方法的具体用法?Python Member.career怎么用?Python Member.career使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类coredata.models.Member
的用法示例。
在下文中一共展示了Member.career方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ensure_member
# 需要导入模块: from coredata.models import Member [as 别名]
# 或者: from coredata.models.Member import career [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
示例2: add_membership_for
# 需要导入模块: from coredata.models import Member [as 别名]
# 或者: from coredata.models.Member import career [as 别名]
def add_membership_for(tacrs, reason, memberships):
if not tacrs.contract.should_be_added_to_the_course or tacrs.total_bu <= 0:
return
# Find existing membership for this person+offering if it exists
# (Behaviour here implies you can't be both TA and other role in one offering: I'm okay with that.)
for m in memberships:
if m.person == person and m.offering == tacrs.course:
break
else:
# there was no membership: create
m = Member(person=person, offering=tacrs.course)
memberships.append(m)
m.role = 'TA'
m.credits = 0
m.career = 'NONS'
m.added_reason = reason
m.config['bu'] = str(tacrs.total_bu)