Correction to the common filter
It is :
db.person._common_filter = lambda query: (db.person.group == db.
auth_user_person_group.person_group)& (db.auth_user_person_group.auth_user
== auth.user.id)
This error is only in the issue description here. So I still get the error
in my code
On Wednesday, November 28, 2018 at 5:54:31 PM UTC+1, icodk wrote:
>
> Getting the following error when setting a common filter on a table:
>
> *Query Not Supported: current transaction is aborted, commands ignored
>> until end of transaction block*
>
>
> Looking in the database log i can see an error on a missing table name in
> a query:
>
> *ERROR: missing FROM-clause entry for table "auth_user_person_group" at
>> character ...*
>
>
> Table definitions:
> db.define_table('person_group',
> Field('name'))
>
> db.define_table('person',
> Field('name'),
> Field('group', 'reference person_group'),
>
>
> The following table is the standard auth_user table and is not part of
> the issue. Mentioned here just for completeness
> db.define_table('auth_user',
> ...
> )
>
> The following table is a many to many that connects personal groups to
> auth_user:
> db.define_table('auth_user_person_group',
> Field('auth_user', 'reference auth_user'),
> Field('group', 'reference person_group'),
> )
>
> ..And this is the common filter I try to use (that gives the above
> mentioned error)
> It's propose is to limit the persons from the person table to those
> belongs to groups that the current auth.user is connected through the many
> to m many table above (auth_user_person_group)
> db.person._common_filter = lambda query: (db.person.person_group ==
> db.auth_user_person_group.person_group)&
> (db.auth_user_person_group.auth_user == auth.user.id)
>
> The query that reaches the database is missing the auth_user_person_group
> table in the FROM part
>
> Help will be greatly appreciated
>
>
>
>
>
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.