Upgrade to py3
This commit is contained in:
parent
5cbe763cb2
commit
5b744a414a
|
@ -1,2 +1 @@
|
|||
from cart import *
|
||||
|
||||
from .cart import *
|
||||
|
|
9
cart.py
9
cart.py
|
@ -177,6 +177,7 @@ def confirm(lang):
|
|||
if not party and not CART_ANONYMOUS:
|
||||
flash(_('Please login in to continue the checkout.'), 'danger')
|
||||
return redirect(url_for('.cart', lang=g.language))
|
||||
|
||||
invoice_address = request.form.get('invoice_address')
|
||||
invoice_address = invoice_address if invoice_address != 'None' else None
|
||||
shipment_address = request.form.get('shipment_address')
|
||||
|
@ -488,7 +489,7 @@ def add(lang):
|
|||
return jsonify(result=False)
|
||||
# post request
|
||||
else:
|
||||
for k, v in request.form.iteritems():
|
||||
for k, v in request.form.items():
|
||||
prod = k.split('-')
|
||||
if prod[0] == 'product':
|
||||
try:
|
||||
|
@ -520,7 +521,7 @@ def add(lang):
|
|||
removes = request.form.getlist('remove')
|
||||
|
||||
# Products Current User Cart (products to send)
|
||||
products_current_cart = [k for k,v in values.iteritems()]
|
||||
products_current_cart = [k for k,v in values.items()]
|
||||
|
||||
# Search current cart by user or session
|
||||
domain = [
|
||||
|
@ -568,7 +569,7 @@ def add(lang):
|
|||
return redirect(url_for('.cart', lang=g.language))
|
||||
|
||||
# Add/Update products data
|
||||
for product_id, qty in values.iteritems():
|
||||
for product_id, qty in values.items():
|
||||
product = None
|
||||
for p in products:
|
||||
if p.id == product_id:
|
||||
|
@ -650,7 +651,7 @@ def add(lang):
|
|||
flash(ngettext(
|
||||
'%(num)s product has been updated in your cart.',
|
||||
'%(num)s products have been updated in your cart.',
|
||||
total), 'success')
|
||||
int(total)), 'success')
|
||||
|
||||
# Delete Cart
|
||||
if to_remove:
|
||||
|
|
32
forms.py
32
forms.py
|
@ -1,7 +1,7 @@
|
|||
from flask_babel import lazy_gettext
|
||||
from flask_wtf import Form
|
||||
from wtforms import IntegerField, TextAreaField, TextField, SelectField, \
|
||||
RadioField, IntegerField, validators
|
||||
from wtforms import (IntegerField, TextAreaField, TextField, SelectField,
|
||||
RadioField, validators)
|
||||
import stdnum.eu.vat as vat
|
||||
|
||||
# VAT Countries
|
||||
|
@ -29,12 +29,12 @@ class SaleForm(Form):
|
|||
|
||||
class PartyForm(Form):
|
||||
"Party form"
|
||||
name = TextField(lazy_gettext('Name'), [validators.Required()])
|
||||
name = TextField(lazy_gettext('Name'), [validators.InputRequired()])
|
||||
vat_country = SelectField(lazy_gettext('VAT Country'), choices=VAT_COUNTRIES)
|
||||
vat_number = TextField(lazy_gettext('VAT Number'))
|
||||
invoice_address = RadioField(lazy_gettext('Invoice Address'))
|
||||
shipment_address = RadioField(lazy_gettext('Shipment Address'))
|
||||
esale_email = TextField(lazy_gettext('E-mail'), [validators.Required(), validators.Email()])
|
||||
esale_email = TextField(lazy_gettext('E-mail'), [validators.InputRequired(), validators.Email()])
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
Form.__init__(self, *args, **kwargs)
|
||||
|
@ -49,13 +49,13 @@ class PartyForm(Form):
|
|||
class ShipmentAddressForm(Form):
|
||||
"Shipment Address form"
|
||||
shipment_id = TextField('ID')
|
||||
shipment_name = TextField(lazy_gettext('Name'), [validators.Required()])
|
||||
shipment_street = TextField(lazy_gettext('Street'), [validators.Required()])
|
||||
shipment_city = TextField(lazy_gettext('City'), [validators.Required()])
|
||||
shipment_zip = TextField(lazy_gettext('Zip'), [validators.Required()])
|
||||
shipment_country = SelectField(lazy_gettext('Country'), [validators.Required(),], coerce=int)
|
||||
shipment_name = TextField(lazy_gettext('Name'), [validators.InputRequired()])
|
||||
shipment_street = TextField(lazy_gettext('Street'), [validators.InputRequired()])
|
||||
shipment_city = TextField(lazy_gettext('City'), [validators.InputRequired()])
|
||||
shipment_zip = TextField(lazy_gettext('Zip'), [validators.InputRequired()])
|
||||
shipment_country = SelectField(lazy_gettext('Country'), [validators.InputRequired(),], coerce=int)
|
||||
shipment_subdivision = IntegerField(lazy_gettext('Subdivision'))
|
||||
shipment_email = TextField(lazy_gettext('E-mail'), [validators.Required(), validators.Email()])
|
||||
shipment_email = TextField(lazy_gettext('E-mail'), [validators.InputRequired(), validators.Email()])
|
||||
shipment_phone = TextField(lazy_gettext('Phone'))
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
@ -71,13 +71,13 @@ class ShipmentAddressForm(Form):
|
|||
class InvoiceAddressForm(Form):
|
||||
"Invoice Address form"
|
||||
invoice_id = TextField('ID')
|
||||
invoice_name = TextField(lazy_gettext('Name'), [validators.Required()])
|
||||
invoice_street = TextField(lazy_gettext('Street'), [validators.Required()])
|
||||
invoice_city = TextField(lazy_gettext('City'), [validators.Required()])
|
||||
invoice_zip = TextField(lazy_gettext('Zip'), [validators.Required()])
|
||||
invoice_country = SelectField(lazy_gettext('Country'), [validators.Required(),], coerce=int)
|
||||
invoice_name = TextField(lazy_gettext('Name'), [validators.InputRequired()])
|
||||
invoice_street = TextField(lazy_gettext('Street'), [validators.InputRequired()])
|
||||
invoice_city = TextField(lazy_gettext('City'), [validators.InputRequired()])
|
||||
invoice_zip = TextField(lazy_gettext('Zip'), [validators.InputRequired()])
|
||||
invoice_country = SelectField(lazy_gettext('Country'), [validators.InputRequired(),], coerce=int)
|
||||
invoice_subdivision = IntegerField(lazy_gettext('Subdivision'))
|
||||
invoice_email = TextField(lazy_gettext('E-mail'), [validators.Required(), validators.Email()])
|
||||
invoice_email = TextField(lazy_gettext('E-mail'), [validators.InputRequired(), validators.Email()])
|
||||
invoice_phone = TextField(lazy_gettext('Phone'))
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
|
Loading…
Reference in New Issue