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