示例#1
0
def add_customer():
  form = VRForms.addcustomer()
  if form.validate_on_submit():
    lead = request.form.get('lead', False) == 'y'
    follow = request.form.get('follow', False) == 'y'
    customer_id = VRDB.customer_add(first_name=request.form['first_name'],
        last_name=request.form['last_name'],
        email=request.form['email'],
        lead=lead,
        follow=follow,
        signup_date=request.form['signup_date'],
        note=request.form['note'])
    return redirect(url_for('customer', customer_id=customer_id))
  return render_template('add_customer.html', form=form)
示例#2
0
def post_add_customer():
  form = VRForms.addcustomer()
  customer_id = -1;
  errors = None;
  if form.validate_on_submit():
    lead = request.form.get('lead', False) == 'y'
    follow = request.form.get('follow', False) == 'y'
    customer_id = customer_add(first_name=request.form['first_name'],
        last_name=request.form['last_name'],
        email=request.form['email'],
        lead=lead,
        follow=follow,
        signup_date=request.form['signup_date'],
        note=request.form['note'])
  return jsonify(errors=errors, customer_id =customer_id)
示例#3
0
def customer(customer_id):
  customer = VRDB.customer(customer_id)
  form = VRForms.addcustomer(MultiDict(customer))
  return render_template('customer.html', form=form)