This worked! Thanks.

Changing line 80 in layout.html from:
        <ul id="navbar" class="nav pull-right">{{='auth' in globals() and 
auth.navbar(mode="dropdown", ) or ''}}</ul>
to:
        <ul id="navbar" class="nav pull-right">{{='auth' in globals() and 
auth.navbar(mode="dropdown", user_identifier='%(username)s') or ''}}</ul>

...did the trick. I had the right idea, but I thought it would need to be 
done in a model.


On Wednesday, October 24, 2012 9:49:09 PM UTC-7, Anthony wrote:
>
> Does this work:
>
> {{=auth.navbar(user_identifier='%(username)s')}}
>
> Anthony
>
> On Thursday, October 25, 2012 12:35:25 AM UTC-4, HittingSmoke wrote:
>>
>> I'm trying to get auth.navbar to display a username after Welcome instead 
>> of trying to display first_name which does not exist in my auth table.
>>
>> I'm not a python wiz, I'm learning it as I learn web2py. I see this in 
>> the gluon.tools source code:
>>
>> def 
>> navbar<http://www.web2py.com/examples/static/epydoc/web2py.gluon.tools.Auth-class.html#navbar>
>> (self, prefix='Welcome', action=None,
>>     separators=(' [ ', ' | ', ' ] '), 
>> user_identifier=DEFAULT<http://www.web2py.com/examples/static/epydoc/web2py.gluon.tools-pysrc.html#>
>> ,
>>     
>> referrer_actions=DEFAULT<http://www.web2py.com/examples/static/epydoc/web2py.gluon.tools-pysrc.html#>
>> , mode='default'): 
>> and just below that...
>> if 
>> self.user_id<http://www.web2py.com/examples/static/epydoc/web2py.gluon.tools-pysrc.html#>
>> :
>>     if user_identifier is 
>> DEFAULT<http://www.web2py.com/examples/static/epydoc/web2py.gluon.tools-pysrc.html#>
>> :
>>         user_identifier = '%(first_name)s'
>>     if callable(user_identifier):
>>         user_identifier = user_identifier(self.user)
>>     elif ((isinstance(user_identifier, str) or
>>           type(user_identifier).__name__ == 'lazyT') and
>>           
>> re.search<http://www.web2py.com/examples/static/epydoc/web2py.gluon.tools-pysrc.html#>
>> (r'%\(.+\)s', user_identifier)):
>>         user_identifier = user_identifier % self.user
>>     if not user_identifier:
>>         user_identifier = '' 
>>
>> Is there a way I can redefine user_identifier in a model instead of 
>> writing my own user management menu?
>>
>

-- 



Reply via email to