Guys, me again o.O

How can I select all products according to the same model? I'm using modal 
to show the products (When I click on Magnifying Glass)


Follow my code:

Controller:
def table_stock():
    somar = db.products.unit_price.sum()
    count = db.products.id.count()
    query = (db.stock.id == db.products.stock)
    results = db(query).select(db.products.ALL, db.stock.ALL,count,somar, 
groupby=db.products.model)

    view = db(db.stock.id == db.products.stock).select(db.products.ALL)
    return locals()

View:

<table id="data-table-simple" class="responsive-table display" 
cellspacing="2">
                <thead>
                    <tr>
                        <th data-field="id">Product Code</th>
                        <th data-field="name_model">Product Model</th>
                        <th data-field="name_manufacturer">Product 
Manufacturer</th>
                        <th data-field="minimum_qtd">Minimum Qtd</th>
                        <th data-field="current_qtd">Current Qtd</th>
                        <th data-field="max_qtd">Max Qtd</th>
                        <th data-field="somar">Total Price</th>
                        <th style="background-image: none;"></th>
                    </tr>
                </thead>

                <tfoot>
                    <tr>
                        <th data-field="id">Product Code</th>
                        <th data-field="name_model">Product Model</th>
                        <th data-field="name_manufacturer">Product 
Manufacturer</th>
                        <th data-field="minimum_qtd">Minimum Qtd</th>
                        <th data-field="current_qtd">Current Qtd</th>
                        <th data-field="max_qtd">Max Qtd</th>
                        <th data-field="somar">Total Price</th>
                        <th style="background-image: none;"></th>
                    </tr>
                </tfoot>
                <tbody>
                    {{for row in results:}}
                    <tr>
                        <td>{{=row.products.id}}</td>
                        <td>{{=row.products.model.name_model}}</td>
                        
<td>{{=row.products.manufacturer.name_manufacturer}}</td>
                        <td>{{=row.stock.minimum_qtd}}</td>
                        <td>{{=row[count]}}</td>
                        <td>{{=row.stock.max_qtd}}</td>
                        <td>$ {{=row[somar]}}</td>
                        <td style="width: 10%;">
                            <a id="products" class="modal-trigger" 
href="#view_products" title="products" style="    position: absolute; 
margin: -19px 37px;font-size: 26px;"><i class="mdi-action-find-in-page" 
style="color: #000;"></i></a>
                        </td>
                    </tr>
                    {{pass}}
                </tbody>
            </table>


<https://lh3.googleusercontent.com/-xyIWD7bPBgk/WxWOdYKwenI/AAAAAAAAACc/HE9BPC3LBxsenxmaRJQ-L0sDbuBstAaeACLcBGAs/s1600/Capturar.JPG>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to