How does that matter the my query?
I have to give some where condition.
Can you elaborate.
On Friday, October 18, 2013 9:05:06 PM UTC+5:30, villas wrote:
>
> HI Jayakumar
>
> Try using a query rather than a rows object.
>
> For example, rather than:
> query = db().select(db.auth_user.ALL) ## gives a rows object,
> unusable by grid
>
> Use this:
> query = db.auth_user.id>0
>
> Hope you get the idea.
> Best regards, D
>
>
>
> On Friday, 18 October 2013 06:43:24 UTC+1, Jayakumar Bellie wrote:
>>
>> Hi,
>>
>> I want to fetch all the auth_group list of a user from auth_user mapping
>> auth_membership.
>>
>> ---------------------------------------------
>> query = db((db.auth_group.id==db.auth_membership.group_id) & (
>> db.auth_user.id==db.auth_membership.user_id) & (db.auth_user.id==
>> auth.user.id)).select(db.auth_group.ALL)
>> * # When I do the return over here, I am able to see the required
>> data. But when I send it to the SQLFORM.grip it through the execption given
>> below*
>> * #return dict(table=where)
>>
>> *
>> displayFields = [db.auth_group.role, db.auth_group.description]
>> displayHeaders = {'auth_group.role': T('Role'),
>> 'auth_group.description' : T('Description')}
>> table = SQLFORM.grid(query,
>> #left=left,
>>
>>
>> fields=displayFields,
>> headers=displayHeaders,
>> deletable=False,
>> create=True,
>> editable=False,
>> details=False,
>> csv=False,
>> links=[lambda row: A("Edit",
>> _href=URL('manage_group', args=[row.id]))],
>>
>> paginate=10)
>> return dict(table=table)
>>
>> ---------------------------------------------
>>
>> Traceback (most recent call last):
>> File "/home/www-data/web2py/gluon/restricted.py", line 212, in restricted
>> exec ccode in environment
>> File "/home/www-data/web2py/applications/Telematics/controllers/group.py"
>> <http://127.0.0.1:8000/admin/default/edit/Telematics/controllers/group.py>,
>> line 64, in <module>
>> File "/home/www-data/web2py/gluon/globals.py", line 194, in <lambda>
>> self._caller = lambda f: f()
>> File "/home/www-data/web2py/gluon/tools.py", line 3022, in f
>> return action(*a, **b)
>> File "/home/www-data/web2py/applications/Telematics/controllers/group.py"
>> <http://127.0.0.1:8000/admin/default/edit/Telematics/controllers/group.py>,
>> line 22, in list_groups
>> paginate=10)
>> File "/home/www-data/web2py/gluon/sqlhtml.py", line 1861, in grid
>> db = query._db
>> AttributeError: 'Rows' object has no attribute '_db'
>>
>>
--
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/groups/opt_out.