I understood, that I select only one table and need take row.NAME without
tablename. But it's intresting what is a_students attribute?
понедельник, 9 декабря 2019 г., 13:30:00 UTC+3 пользователь Константин
Комков написал:
>
> My query return attribute 'a_students' for row, but in select I wrote '
> db.a_groups.NAME'. Why?
> Web2py 2.18.5-stable+timestamp.2019.04.08.04.22.03
> (Running on Rocket 1.2.6, Python 3.7.3)
>
> tables.py
>
> db.define_table(
> 'a_groups',
> Field('ACADEMIC_YEAR', 'integer'),
> Field('NAME', length=25),
> Field('STATUS', 'integer'),
> Field('INACTIVE', 'integer', rname='"INACTIVE"'),
> Field('FO', 'integer'),
> Field('WLP', 'integer'),
> Field('FAC', 'reference t_fac'),
> migrate=False
> )
>
> db.define_table(
> 'a_students',
> Field('GROUP_ID', 'reference a_groups'),
> migrate=False
> )
>
> db.define_table(
> 'tt_main',
> Field('GROUP_ID', 'reference a_groups'),
> Field('MODULE', 'integer'),
> migrate=False
> )
>
> default.py
>
> groups = db((db.a_groups.FO == 1) & (db.a_groups.FAC == faculty) &
> (db.a_groups.STATUS == 2) &
> (db.a_groups.INACTIVE == 0)).select(db.a_groups.id, db.a_groups.NAME)
>
> for row in groups:
> ...
>
> then I have error becouse row don't have 'a_groups'. Why I have
> 'a_students' attribute?
> <Row {'id': 1754, '*a_students*': <Set (a_students...et (tt_main.GROUP_ID
> = 1754)>, 'NAME': 'Д-А401'}>
>
--
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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/web2py/857717bc-b7a9-434d-b36f-c0114a33c8e6%40googlegroups.com.