Hi have this structure:

db.py:

#DEFINE PRODUCT INPUT
db.define_table('product_input',
    Field('product', db.product, notnull=True),
    Field('total_price','decimal(7,2)', readable=False,writable=False),
    Field('amount', 'integer', readable=False,writable=False),
    Field('supplier', db.supplier, notnull=True),
    Field('location', db.location, notnull=True),
    Field('input_type', 'string'),
    auth.signature,
    format = lambda r: '%s %s %s %s  [%s]' % (r.product.model.model, 
r.product.manufacturer.manufacturer, r.product.part_number, 
       r.product.serial_number, r.product.expiration_date)
    
    )

db.define_table('product_output',
    Field('product', 'list:reference product_input', multiple=True),
    Field('ship', db.ship, notnull=True),
    Field('total_price', 'decimal(7,2)', writable=False),
    Field('data_output', 'date', notnull=True),
    Field('output_type', 'string', notnull=True),
    auth.signature,
    format = '%(product)s'
    )

default.py:

def new_product_input():
    form = SQLFORM(db.product_input)
    if form.process().accepted:
        session.flash = 'Registration Saved Successfully'
        redirect(URL('product_input'))
    elif form.errors:
        response.flash = 'Attention: errors in the form.'
    return dict(form=form)


view: 

{{extend 'new-layout.html'}}

{{=form.custom.begin}}
<div class="content mt-3">
<div class="animated fadeIn">
<div class="col-lg-12">
<div class="card">

<div class="card-header">
<strong>Stock Output</strong> Add<div class="w2p_flash alert 
alert-dismissable" style="color: red;">{{=response.flash or ''}}</div>
</div>
<div class="card-body card-block">
<div class="row form-group">
<div class="col col-md-3"><label for="text-input" class=" 
form-control-label">Product in Stock</label></div>
<div class="col-12 
col-md-6">{{=form.custom.widget.product_input.product}}<small 
class="form-text text-muted">Select the Product in Stock</small></div>
<div class="col col-md-2"><a class="btn btn-outline-primary" 
href="{{=URL('product_input')}}" target="new" role="button">Add New Product 
to Stock</a></div>
</div>



I GET THIS ERROR: AttributeError: 'NoneType' object has no attribute 
'product'

HOW CAN I VIEW THE LIST IN HTML??

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to