[web2py] Re: ASK Web2py Groups:Is there a better way?

2011-10-29 Thread Anthony
default=auth.user.first_name if auth.user else 'some_other_default' or default=auth.user and auth.user.first_name or 'some_other_default' Anthony On Saturday, October 29, 2011 6:10:34 PM UTC-4, Pystar wrote: > > In an app I am developing, in my database definition I have a filed > whose defaul

[web2py] Re: ASK Web2py Groups:Is there a better way?

2011-10-29 Thread Pystar
thanks On Oct 29, 11:46 pm, Anthony wrote: > default=auth.user.first_name if auth.user else 'some_other_default' > > or > > default=auth.user and auth.user.first_name or 'some_other_default' > > Anthony > > > > > > > > On Saturday, October 29, 2011 6:10:34 PM UTC-4, Pystar wrote: > > > In an app

[web2py] Re: ASK Web2py Groups:Is there a better way?

2011-10-29 Thread Pystar
I actually did this and it worked, I put this at the top of my module file: def func(): if auth.user == None: return "Anon" else: return auth.user.first_name and in my table definition I did this: Field("auctioner", "string", default = func(), required=True, readable=False

[web2py] Re: ASK Web2py Groups:Is there a better way?

2011-10-29 Thread Anthony
On Saturday, October 29, 2011 6:58:53 PM UTC-4, Pystar wrote: > > I actually did this and it worked, > > I put this at the top of my module file: > def func(): > if auth.user == None: > return "Anon" > else: > return auth.user.first_name > Seems like overkill, particu