I need to display my form in a customized view with checkboxes I added to
each row but it wont let me use form.custom, whats the solution, drivin me
nuts?
heres my code
controller
def buy_now_coin_listing():
'''
list all coins in users collection that don't have a for sale listing
add a check box for them to select and add to for sale listings
'''
items=db((db.deannas_dough.currently_owned_by==USER_ID) &
(db.deannas_dough.for_sale_listing_date==None)&(db.deannas_dough.mint_orders_id==db.mint_orders2.id)).select(db.deannas_dough.id,db.deannas_dough.title,db.deannas_dough.cash_out_value,db.deannas_dough.mint_errors,db.deannas_dough.letter,db.deannas_dough.created_on,db.mint_orders2.image,orderby=db.deannas_dough.won_on)
# db.deannas_dough.id.represent=lambda id: DIV(id,INPUT
#(_type='checkbox',_name='check_%i'%id))
db.deannas_dough.id.represent=lambda id: DIV(id,INPUT
(_type='input',_style='{width=20px}',_onchange='if
(isNaN(parseFloat(this.value))){this.value="";};',_name='asking_price_%i'%id))
form=FORM(SQLTABLE(items),INPUT(_type='submit',_value='List Coins for
Sale with Asking Prices I defined above'))
if form.accepts(request.vars,session,keepvalues=True):
for k,v in request.vars.items():
if k.startswith('asking_price_'):
id = k.split('_')[-1]
item = db(db.deannas_dough.id == int(id)).select()[0]
if len(v)>0:
check = True
else:
check= False
if check == True:
item.update_record(for_sale_listing_date=request.now,buy_now_listing=True,for_sale_listing_price=v)
redirect('buy_now_coin_listing')
for_sale =
db((db.deannas_dough.currently_owned_by==USER_ID)&(db.deannas_dough.buy_now_listing==True)).select(db.deannas_dough.id,db.deannas_dough.title,db.deannas_dough.cash_out_value,db.deannas_dough.mint_errors,db.deannas_dough.letter,db.deannas_dough.created_on,db.deannas_dough.for_sale_listing_price,db.mint_orders2.image,orderby=db.deannas_dough.won_on)
return dict(form=form,for_sale=for_sale)
view:
buy_now_coin_listing.html
{{=form.custom.begin}}
{{=form.custom.widget.id}}
.. styling image row stuff here...
{{=form.custom.submit}}
{{=form.custom.end}}
results:
error, no attribute custom in form