I want to show the UnitPrice like $1,000,00 but it shows 1000.00. 

*Model*

db.define_table('KR_Product',
    Field('ProductCode', length=15),
    Field('PartNumber', length=50),
    Field('SubA', length=15),
    Field('SubB', length=15),
    Field('UnitPrice', 'decimal(18,2)'),
    Field('Quantity', 'decimal(18,0)'),
    Field('Weight', 'decimal(18,3)'),
    Field('LeadTime', length=50),
    Field('Model', length=2),
    Field('Lead', length=2),
    Field('Block', length=1),
    Field('Stroke', length=4),
    Field('Grade', length=1),
    Field('Cover', length=1),
    Field('Sensor', length=1),
    Field('Housing', length=1),
    Field('Flange', length=1),
    Field('Description', length=500)
    )

db.KR_Product.UnitPrice.represent = lambda value, row: '$ %.2f' % (0.0 if 
value == None else value)


*View*

<div id="container">            
    <div id="wrapper">
    <table class="table table-hover">
            <thead>
                <th>Part Number</th>
                <th>Lead Time</th>
                <th style="text-align: right;"><span 
class='right'>Quantity</th>
                <th style="text-align: right;"><span class='right'>Unit 
Price($)</th>
                <th style="text-align: right;"><span 
class='right'>Weight(kg)</th>
  </thead>
            <tbody>
                 {{for list in lists:}}
    <tr>
    <td>{{=list.PartNumber}}</td>
        <td>{{=list.LeadTime}}</td>
                <td style="text-align: right;">{{=list.Quantity}}</td>
                <td style="text-align: right;">{{=list.UnitPrice}}</td>
                <td style="text-align: right;">{{=list.Weight}}</td>   
        </tr>
                {{pass}}
            </tbody>
</table>
    </div>
</div>

-- 
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