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


Python Student.long_period方法代碼示例

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


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

示例1: form2student

# 需要導入模塊: from enroll.models import Student [as 別名]
# 或者: from enroll.models.Student import long_period [as 別名]
def form2student(form,course):
    st = Student()
    st.status = 'n'
    st.course_key=str(course.key())
    st.init_reg()
    st.init_ref_base()
    st.addressing = form.cleaned_data['addressing']
    st.name = form.cleaned_data['name']
    st.surname = form.cleaned_data['surname']
    st.student = form.cleaned_data['student']
    st.long_period = form.cleaned_data['long_period']
    st.year = form.cleaned_data['year']
    st.email = form.cleaned_data['email']
    st.no_email_ad = form.cleaned_data['no_email_ad']
    st.phone = form.cleaned_data['phone']
    st.street = form.cleaned_data['street']
    st.street_no = form.cleaned_data['street_no']
    st.city = form.cleaned_data['city']
    st.post_code = form.cleaned_data['post_code']
    st.school = form.cleaned_data['school']
    st.school_class = form.cleaned_data['school_class']
    st.comment = form.cleaned_data['comment']
    #st.partner_ref_code = form.cleaned_data['partner']

    if course.cost_sale:
        a = course.cost_sa
        b = course.cost_sb
    else:
        a = course.cost_a
        b = course.cost_b
    
    if course.cost_mode == 'Normal':
        if (st.student):
            st.course_cost = b
        else:
            st.course_cost = a
    elif course.cost_mode == 'Period':
        if (st.long_period):
            st.course_cost = a 
        else:
            st.course_cost = b
    elif course.cost_mode == 'Fix':
        st.course_cost = a

    st.save()
    st.init_gid()  #ok
    st.init_ref_codes()
    st.save()
    return st
開發者ID:,項目名稱:,代碼行數:51,代碼來源:


注:本文中的enroll.models.Student.long_period方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。