I have this:
db.py:
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)
)
default.py:
def stock():
count = db.product_input.id.count()
results = db(db.product_input).select(db.product_input.product, count,
groupby=db.product)
return locals()
view:
{{for row in results:}}
<tr>
<td>{{=row[db.product_input.product]}}</td>
<td>{{=row[count]}}</td>
</tr>
{{pass}}
APPEARS JUST THIS:
Product in Stock [Model]Amount
6 2
7 2
HOW CAN APPEARS THE NAME NOT THE ID ON DE LINE?
--
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.