add a default query in your dal expression ? q = db.whatever.contract == contractid
then db(yourquery)(q) otherwise you can poke around with multi_tenancy http://web2py.com/books/default/chapter/29/06#Common-fields-and-multi-tenancy On Sunday, December 2, 2012 8:20:15 AM UTC+1, Andrey Gadyukov wrote: > > Is there a way to realize the condition of the table that will be executed by > default? As in ActiveRecord (defaultScope). > E.g.: Need to get the record for a particular user on the number of his > contract. > In PHP I do that: > function defaultScope() > { > if (user->role == "admin"){ > return ['order' => 'call_date DESC']; > } else { > $contract = user->contract_number; > return ['order' => 'call_date DESC', 'condition' => "contract = > {$contract}"]; > } > } > > But I don't know how do that in web2py. --