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


Python Student.no_email_ad方法代码示例

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


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

示例1: form2student

# 需要导入模块: from enroll.models import Student [as 别名]
# 或者: from enroll.models.Student import no_email_ad [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,代码来源:

示例2: import_student2

# 需要导入模块: from enroll.models import Student [as 别名]
# 或者: from enroll.models.Student import no_email_ad [as 别名]
def import_student2(course,row):
    logging.info('import student2 data=%s'%(row))
    
    try:
        s = row[0].lower()
        if not (s in ['p','s','d','?']):
            logging.info('skip, no p/s/d/? at first col')
            return None
    except:
        logging.info('skip, no p/s/d/? at first col')
        return None
    
    
    st = Student()
    
    st.status = 'e'
    st.course_key=str(course.key())
    st.init_reg()
    st.init_ref_base()
    s = row[0].lower()
    if s in ['p','s','d']:
        st.addressing = s
    
    st.surname = row[2]
    st.name = row[1]

    try:
        st.course_cost = int(row[3])
    except:
        st.course_cost = 0

    try:
        st.paid = int(row[4])
    except:
        st.paid = 0

       
        
    st.discount = row[5]
    
    st.pay_info = row[6]
    
    st.email = row[7]
    st.phone = row[8]


    st.street = row[9]
    st.street_no = row[10]
    st.city = row[11]
    st.post_code = row[12]



    st.school = row[13]
    st.school_class = row[14]


    st.comment = row[15]

    st.no_email_notification = True
    st.no_email_info = not valid_email(st.email)
    st.no_email_ad = st.no_email_info
   
   
    st.student = True
    st.student_check = False

   
    st.save()
    st.init_ref_codes()
    st.save()

 
    return st
开发者ID:prcek,项目名称:TSReg,代码行数:76,代码来源:import_views.py

示例3: import_student

# 需要导入模块: from enroll.models import Student [as 别名]
# 或者: from enroll.models.Student import no_email_ad [as 别名]
def import_student(course,row):
    logging.info('import student data=%s'%(row))

    st = Student()
    st.status = 'e'
    st.course_key=str(course.key())
    st.init_reg()
    st.init_ref_base()
    s = row[2].lower()
    if s in ['p','s','d']:
        st.addressing = s
    
#    st.addressing = form.cleaned_data['addressing']
    st.name = row[4]
    st.surname = row[3]


    try:
        st.x_import_no_1 = int(row[0])
    except:
        pass
    try:
        st.x_import_no_2 = int(row[1])
    except:
        pass

# 5 6 7 - prachy

    try:
        paid = int(row[5])
    except:
        paid = 0
    try:
        to_pay = int(row[6])
    except:
        to_pay = 0
        
    st.course_cost = paid+to_pay
    st.paid = paid
        
    st.discount = row[7]
    logging.info('sleva: %s'%st.discount)    

# 8,9 skola  trida
    st.school = row[8]
    st.school_class = row[9]

    st.student = AnoNe2Bool(row[17])
    st.student_check = AnoNe2Bool(row[18])
    
#    st.long_period = form.cleaned_data['long_period']
#    st.year = form.cleaned_data['year']
    st.email = row[15]
    spam = AnoNe2Bool(row[16])
    if spam is True:
        st.no_email_ad = False
    else:
        st.no_email_ad = True

    st.no_email_notification = True
    st.no_email_info = not valid_email(st.email)
    if st.no_email_info:
        st.no_email_ad = True
    st.phone = row[14]
    st.street = row[10]
    st.street_no = row[11]
    st.city = row[12]
    st.post_code = row[13]

    st.comment = row[19]

    st.save()
    st.init_ref_codes()
    st.save()

    return st
开发者ID:prcek,项目名称:TSReg,代码行数:78,代码来源:import_views.py


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