Hi

I have a parent chile relationship Vessels / Voyages .
Each vessel may have 1 or more Voyage .

The Voyage Grid form attached is working fine except that i want the Order 
to by Vessel name(from Vessels ) and then VoyageNumber (from voyages) .
As it is written now  the order is by Vessel.id , VoyageNumber .

Model

---------

db.define_table('EQ_Vessels',

Field('VesselCode', 'string' , length=3 , notnull = True,unique = True) ,

Field('VesselName', 'string', length=50, notnull = True,unique = True) ,

format='%(VesselName)s' )

db.EQ_Vessels._plural='Vessels'

db.define_table('EQ_Voyages',

Field('Vessel','reference EQ_Vessels' ,required=True ) ,

Field('VoyageNumber', 'string' , notnull = True , required=True )

)

db.EQ_Voyages._plural='Voyages'

db.EQ_Voyages.VoyageNumber.requires=IS_NOT_IN_DB(

db(db.EQ_Voyages.Vessel==request.vars.Vessel), 'EQ_Voyages.VoyageNumber')

Controller

-------------

def Voyages():

Voyages = SQLFORM.grid(db.EQ_Voyages,csv=False , 
orderby=db.EQ_Voyages.Vessel| db.EQ_Voyages.VoyageNumber)

return dict(form=Voyages)

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