hey everyone,
running 2.18.5. ok under the db.py i have something like:
db.define_table('courses',
Field('subject_id', db.subjects, requires=IS_IN_DB(db, db.subjects.id,
'%(subject)s
(%(id)s)'), writable=False, readable=False),
Field('user_id', db.auth_user, requires=PROFESSOR, default=(auth.user.id
if auth.is_logged_in() else None), writable=False, readable=False),
etc...
COURSE = IS_IN_DB(db(db.courses.user_id==auth.user_id), db.courses.id,
'%(title)s
(%(id)s)')
db.define_table('lectures',
Field('course_id', db.courses, requires=COURSE, writable=False, readable
=False),
etc...
db.define_table('questions',
Field('course_id', db.courses, requires=COURSE, writable=False, readable
=False),
Field('lecture_id', db.lectures, requires=IS_EMPTY_OR(IS_IN_DB(db(db.
lectures.course_id==session.course_id), db.lectures.id, '%(title)s
(%(course_id)s, %(id)s)'))),
etc....
and under the controller.py, i'll have:
def questions():
cidi = mcp.request_to_int(request.args(0), None) #class id
qidi = mcp.request_to_int(request.args(1), None) #question id
if (cidi is not None):
session.course_id = cidi #for subsetting lecture_id in db.
qfrm = SQLFORM(db.questions, record=qidi, showid=False)
etc...
where the select options of lecture_id is always lagging by one, meaning,
if cidi is 4 now, lecture_id items are showing for 2, where the 2 was my
previous cidi.
if i replace the latter line "session.course_id..." with:
db.questions.lecture_id.requires = IS_EMPTY_OR(IS_IN_DB(db(db.
lectures.course_id==cidi), db.lectures.id, '%(title)s (%(course_id)s,
%(id)s)'))
then all is good again. i don't remember a lag like this in previous
versions. but i could be mistaken. and i'm not sure what to think about
this right now. just reporting.
thank you in advance, lucas
--
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.