Ok so I am COMPLETELY new to PYTHON and Django all together. I am currently working on a form for a django site. In my views.py it sends an email filled with the data from that form. Basically, its an order form that 4 cloumns (Product, Color, Qty, Price/ea) with 10 rows someone can fill out.
What I am trying to do in the email is have it print those for columns as many times as there is a product. So product1 is required and product2-10 is not. Also I should add that I have defined price1-10 for the ability to let the recipient know how much ammount is (it takes the price/ea and multiplies it by the quantity.) Hence the price2 you will see below.
If a customer fills in product1 and product2 for two seperate products, but not any other products I want views.py to quit building the email after product2.
Currently here is what I have to try and handle this:
And here is the error I am getting...
ValueError at /order-form/
empty string for float()
Request Method: POST
Exception Type: ValueError
Exception Value: empty string for float()
Any help someone could be with this would be wonderful! Thanks!
MM
What I am trying to do in the email is have it print those for columns as many times as there is a product. So product1 is required and product2-10 is not. Also I should add that I have defined price1-10 for the ability to let the recipient know how much ammount is (it takes the price/ea and multiplies it by the quantity.) Hence the price2 you will see below.
If a customer fills in product1 and product2 for two seperate products, but not any other products I want views.py to quit building the email after product2.
Currently here is what I have to try and handle this:
Code:
try:
price2 = (float(orderformdata['product_qty2'])) * int(orderformdata['product_price2']);
body+= "<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>" % (orderformdata['product_name2'],orderformdata['product_color2'],orderformdata['product_qty2'],orderformdata['product_price2'],price2)
except:
if price2 is null
then
the result is 'EXIT', termg
pass
ValueError at /order-form/
empty string for float()
Request Method: POST
Exception Type: ValueError
Exception Value: empty string for float()
Any help someone could be with this would be wonderful! Thanks!
MM
Comment