Hello,

I at one point had smart_query working correctly (at least it seemed) with 
SQLFORM.grid but after having some issues with my database I had to rebuild 
some parts and it seems I cannot for the life of me get the smart_query 
functionality working again to have it show with SQLFORM.grid.  Below is my 
sample code that I am trying to work with:

modules (db.py) (some misc stuff has been left out of the code block below):


db = DAL('mysql://<connection>/<db>')



db.define_table('inventory_hardware',
                Field('employee', 'string', required=False, label='Employee'
),
                Field('department', 'string', required=False, label=
'Department'),
                Field('computername', 'string', required=True, label='Computer 
Name'),
                Field('serial', 'string', label='Serial Number'),
                Field('model', 'string', label='Computer Model'),
                Field('category', 'string', label='Hardware Category'),
                Field('office', 'string', label='Office Location'),
                Field('date', 'date', label='Date Inventoried'),
                Field('LocCord', 'string', label='Location Coordinates'),
                Field('auction_item_number', 'string', label='Auction Item 
Number'),
                Field('current_condition', 'string', requires= IS_EMPTY_OR(
IS_IN_SET(CURRENTCONDITION)), label='Condition'),
                Field('date_disposed', 'date', label='Date Disposed'),
                Field('lit_hold', 'string', requires= IS_EMPTY_OR(IS_IN_SET(
LITHOLD)), label='Litigation Hold'),
                Field('lit_hold_number', 'string', label='Litigation Hold 
Number'),
                auth.signature)


#pulls information from my modules file to create dropdown selections on 
certain parts of the SQLFORM.grid field
db.inventory_hardware.department.requires = IS_IN_SET(DEPARTMENT)
db.inventory_hardware.category.requires = IS_IN_SET(CATEGORY)


auth.enable_record_versioning(db)




controller (inventory.py):

def userinv():
    search = 'category equal Desktop or category equal Laptop'
    rows = db.smart_query([db.inventory_hardware],search).select()
    userinvgrid = SQLFORM.grid(db.inventory_hardware, user_signature=False)
    return locals()




view (inventory/userinv.html):

{{extend 'layout.html'}}
{{=userinvgrid}}


So basically I have the main table that is storing all the information of 
inventory items.  I then am wanting to create different pages that will 
show specific information based on the category that an item is placed 
under (Desktop, Laptop, Server, Printer, etc).  This is where I figured 
that web2py's smart_query function would work the best, but I cannot get my 
smart_query functionality to show properly in the SQLFORM.grid, I did a lot 
of searching and there is not a lot information on this functionality.

If anyone would lend me some advice or suggestions to try or even 
explain/show or recommend a better solution to the idea I looking to do 
that would be the greatest thing ever to me.

Thank you in advance,
EvilLinux

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