hi, i'm a newbie to web2py but i'm very intrigued. the issue i'm
having is that i'd like to associate information with rows of a
sqlset.
for example, i am creating a page that enrolls/unenrolls users
(students) in a program (section). i want to list the students in the
section, then list all students (including the enrolled students) for
selection purposes. and in that bottom area, i want the enrolled
students to be marked somehow.
i have successfully created a sqlset "enrolled" as well as one called
"allstudents." now what i want to do is go through each studentand
mark ones who are in the set "enrolled." what is the best method to
mark the students?
initially i tried to create a dummy field in the sql and then populate
it in a for loop. but sqlsets appear to be immutable. how can i
accomplish this?
thanks,
matt
i have three tables -- students, sections and a many-to-many
studentsections.
relevant code:
qenrolled= (db.students.id==db.studentsections.userid)&
(db.sections.id==db.studentsections.sectionid)&
(db.studentsections.sectionid==id)
enrolled= db(qenrolled).select(db.students.fullname,
db.sections.name, db.students.id, db.studentsections.sectionid,
orderby=db.students.fullname)
qallstudents= (db.students.id > 0)&(db.students.nowenrolled=='Y')
allstudents= db(qallstudents).select(db.students.fullname,
db.students.id, orderby=db.students.fullname)
for student in allstudents:
if student in enrolled:
#do something to the enrolled students
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---