예제 #1
0
def cmanager_add_post(db): 
    form=cmanager_forms.cmanage_add_form()
    if not form.validates(source=request.forms):
        return render("base_form", form=form)    

    if db.query(models.SlcCustomerManager).filter(
            models.SlcCustomerManager.manager_code==form.d.manager_code).count()>0:
        return render("base_form",form=form,msg=u"工号重复")
    
    if db.query(models.SlcCustomerManager).filter(
            models.SlcCustomerManager.active_code==form.d.active_code).count()>0:
        return render("base_form",form=form,msg=u"激活码重复")


    cmanager = models.SlcCustomerManager()
    cmanager.manager_code = form.d.manager_code
    cmanager.manager_name = form.d.manager_name
    cmanager.manager_mobile = form.d.manager_mobile
    cmanager.manager_email = form.d.manager_email
    cmanager.active_code = form.d.active_code
    cmanager.active_status = 0
    cmanager.create_time = utils.get_currtime()

    db.add(cmanager)
    db.commit()
    redirect("/cmanager/list")
예제 #2
0
def cmanager_add_post(db, render):
    form = cmanager_forms.cmanage_add_form(oprs=get_oprs(db))
    if not form.validates(source=request.forms):
        return render("base_form", form=form)

    if db.query(models.SlcCustomerManager).filter(
            models.SlcCustomerManager.manager_code ==
            form.d.manager_code).count() > 0:
        return render("base_form", form=form, msg=u"工号重复")

    cmanager = models.SlcCustomerManager()
    cmanager.manager_code = form.d.manager_code
    cmanager.manager_name = form.d.manager_name
    cmanager.manager_mobile = form.d.manager_mobile
    cmanager.manager_email = form.d.manager_email
    cmanager.operator_name = form.d.operator_name
    cmanager.create_time = utils.get_currtime()

    db.add(cmanager)
    db.commit()
    redirect("/cmanager/list")
예제 #3
0
def cmanager_add(db):   
    form = cmanager_forms.cmanage_add_form()
    return render("base_form",form=form)
예제 #4
0
def cmanager_add(db, render):
    form = cmanager_forms.cmanage_add_form(oprs=get_oprs(db))
    return render("base_form", form=form)
예제 #5
0
def cmanager_add(db, render):
    form = cmanager_forms.cmanage_add_form(oprs=get_oprs(db))
    return render("base_form", form=form)