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


Python Customer.address1方法代碼示例

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


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

示例1: addCustomer

# 需要導入模塊: from models import Customer [as 別名]
# 或者: from models.Customer import address1 [as 別名]
def addCustomer():
    form = AddCustomerForm()

    form.recommender.choices = [(0, '')]
    poss_customers = Customer.query\
        .filter(Customer.customer_type == CUSTOMER_TYPES['TYPE_CUSTOMER']).all()
    for cust in poss_customers:
        form.recommender.choices.append((cust.id, cust.name))

    if form.validate_on_submit():
        customer = Customer()

        customer.name = form.name.data
        customer.email = form.email.data
        customer.base_discount = int(form.base_discount.data)/100.0

        if form.recommender.data and form.recommender.data > 0:
                customer.recommender_id = form.recommender.data

        customer.company_name = form.company_name.data
        if form.post_code1.data and form.post_code2.data:
            customer.post_code = int(str(form.post_code1.data) + str(form.post_code2.data))
        else:
            customer.post_code = None
        customer.address1 = form.address1.data
        customer.address2 = form.address2.data
        customer.address3 = form.address3.data

        db.session.add(customer)
        db.session.commit()
        flash(gettext("New customer successfully added."))
        return redirect(url_for("customers"))
    return render_template('settings/addCustomer.html',
                           title=gettext("Add New Customer"),
                           form=form)
開發者ID:HeinzHinek,項目名稱:AxiStore,代碼行數:37,代碼來源:viewsCustomer.py


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