Re: [web2py] Re: Virtual Fields in auth_user?

2014-08-30 Thread Tim Korb
Did you ever get this working?  I tried the same thing, adding

Field.Virtual('last_first', lambda row: %s, %s % 
(row.auth_user.last_name, row.auth_user.first_name))

to auth.settings.extra_fields['auth_user'], but get the same error message 
when trying to build the SQLFORM.grid.

Tim


On Thursday, July 10, 2014 8:26:01 AM UTC-4, Fabiano Almeida wrote:

 Hi Massimo,

 I tried this:

 auth.settings.extra_fields['auth_user']= [
 ...
 Field('dept_grid', compute = lambda row: 
 Departamento[row['departamento_id']].nome if row['departamento_id'] else 
 None, label = 'Departamento'),
 Field.Virtual('dept_name', lambda row: 
 Departamento[row.departamento_id].nome if row.departamento_id else None, 
 label = 'Departamento')]

 The compute field work, the virtual field does not work. And the error by 
 calling the table in SQLFORM.grid:

 AttributeError: 'Row' object has no attribute 'dept_name'


 Can I use virtual field to display information from another table?

 Thanks,

 Fabiano.


 2014-07-10 3:55 GMT-03:00 Massimo Di Pierro massimo@gmail.com 
 javascript::

 auth.settings.extra_fields['auth_user'] = [Field.Virtual(), ... ]


 On Wednesday, 9 July 2014 13:14:14 UTC-5, Fabiano Almeida wrote:

 Hi again,

 It's possible insert virtual field in auth_user? how?

 thanks,

 Fabiano.

  -- 
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 --- 
 You received this message because you are subscribed to the Google Groups 
 web2py-users group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to web2py+un...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/d/optout.




-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Virtual Fields in auth_user?

2014-07-10 Thread Massimo Di Pierro
auth.settings.extra_fields['auth_user'] = [Field.Virtual(), ... ]

On Wednesday, 9 July 2014 13:14:14 UTC-5, Fabiano Almeida wrote:

 Hi again,

 It's possible insert virtual field in auth_user? how?

 thanks,

 Fabiano.


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: Virtual Fields in auth_user?

2014-07-10 Thread Fabiano Almeida
Hi Massimo,

I tried this:

auth.settings.extra_fields['auth_user']= [
...
Field('dept_grid', compute = lambda row:
Departamento[row['departamento_id']].nome if row['departamento_id'] else
None, label = 'Departamento'),
Field.Virtual('dept_name', lambda row:
Departamento[row.departamento_id].nome if row.departamento_id else None,
label = 'Departamento')]

The compute field work, the virtual field does not work. And the error by
calling the table in SQLFORM.grid:

AttributeError: 'Row' object has no attribute 'dept_name'


Can I use virtual field to display information from another table?

Thanks,

Fabiano.


2014-07-10 3:55 GMT-03:00 Massimo Di Pierro massimo.dipie...@gmail.com:

 auth.settings.extra_fields['auth_user'] = [Field.Virtual(), ... ]


 On Wednesday, 9 July 2014 13:14:14 UTC-5, Fabiano Almeida wrote:

 Hi again,

 It's possible insert virtual field in auth_user? how?

 thanks,

 Fabiano.

  --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 You received this message because you are subscribed to the Google Groups
 web2py-users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Virtual Fields on auth_user

2012-11-24 Thread Massimo Di Pierro
Please open a ticket about this. 

On Friday, 23 November 2012 12:59:37 UTC-6, Alex Benfica wrote:

 Hi!

 I found this...

 https://groups.google.com/forum/?fromgroups=#!topic/web2py/77ei0yBbuhw

 Wil this feature be included again some day? 
 Web2py is fine... and it is getting better each day!




 Em sexta-feira, 23 de novembro de 2012 16h57min33s UTC-2, Alex Benfica 
 escreveu:

 Hi!

 I have the same problem and the virtual fields availble on auth.user 
 would save me 1 RPC call per request on App Engine.
 Is that a bug or is it the natural behavior!?

 I'm using web2py version  2.2.1!

 Thanks!


 Em sábado, 23 de abril de 2011 16h55min28s UTC-3, Gregory Hellings 
 escreveu:

 I have a virtual field attached to the auth_user table titled name 
 that renders the user's name with certain formatting based on auth 
 membership.  I also have records in a second table that are linked to 
 the auth_user table.  When I fetch these rows I can access the virtual 
 as expected: 

 row.speaker.name 

 However, when I access the auth.user variable to determine the 
 current user, it lacks the appropriate virtual field.  Thus calling 
 auth.user.name returns the string '0' (when it is JSON-ified) 
 instead of the user's name with formatting. 

 I'm supposing that the framework does not bind the virtual fields 
 until after the auth object has been initialized, since they are 
 declared in my db_auth.py file after the auth object is instantiated. 
 Is this missing virtual field intended behavior, a documented problem 
 that is a shortcoming of needing to declare the auth object before 
 binding the virtual fields, or a bug? 

 --Greg



-- 





[web2py] Re: Virtual Fields on auth_user

2012-11-23 Thread Alex Benfica
Hi!

I have the same problem and the virtual fields availble on auth.user would 
save me 1 RPC call per request on App Engine.
Is that a bug or is it the natural behavior!?

I'm using web2py version  2.2.1!

Thanks!


Em sábado, 23 de abril de 2011 16h55min28s UTC-3, Gregory Hellings escreveu:

 I have a virtual field attached to the auth_user table titled name 
 that renders the user's name with certain formatting based on auth 
 membership.  I also have records in a second table that are linked to 
 the auth_user table.  When I fetch these rows I can access the virtual 
 as expected: 

 row.speaker.name 

 However, when I access the auth.user variable to determine the 
 current user, it lacks the appropriate virtual field.  Thus calling 
 auth.user.name returns the string '0' (when it is JSON-ified) 
 instead of the user's name with formatting. 

 I'm supposing that the framework does not bind the virtual fields 
 until after the auth object has been initialized, since they are 
 declared in my db_auth.py file after the auth object is instantiated. 
 Is this missing virtual field intended behavior, a documented problem 
 that is a shortcoming of needing to declare the auth object before 
 binding the virtual fields, or a bug? 

 --Greg

-- 





[web2py] Re: Virtual Fields on auth_user

2012-11-23 Thread Alex Benfica
Hi!

I found this...

https://groups.google.com/forum/?fromgroups=#!topic/web2py/77ei0yBbuhw

Wil this feature be included again some day? 
Web2py is fine... and it is getting better each day!




Em sexta-feira, 23 de novembro de 2012 16h57min33s UTC-2, Alex Benfica 
escreveu:

 Hi!

 I have the same problem and the virtual fields availble on auth.user would 
 save me 1 RPC call per request on App Engine.
 Is that a bug or is it the natural behavior!?

 I'm using web2py version  2.2.1!

 Thanks!


 Em sábado, 23 de abril de 2011 16h55min28s UTC-3, Gregory Hellings 
 escreveu:

 I have a virtual field attached to the auth_user table titled name 
 that renders the user's name with certain formatting based on auth 
 membership.  I also have records in a second table that are linked to 
 the auth_user table.  When I fetch these rows I can access the virtual 
 as expected: 

 row.speaker.name 

 However, when I access the auth.user variable to determine the 
 current user, it lacks the appropriate virtual field.  Thus calling 
 auth.user.name returns the string '0' (when it is JSON-ified) 
 instead of the user's name with formatting. 

 I'm supposing that the framework does not bind the virtual fields 
 until after the auth object has been initialized, since they are 
 declared in my db_auth.py file after the auth object is instantiated. 
 Is this missing virtual field intended behavior, a documented problem 
 that is a shortcoming of needing to declare the auth object before 
 binding the virtual fields, or a bug? 

 --Greg



--