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.

-- 



Reply via email to