hi all. i've done a lot with ajax, but am building my first web2py
app, and i have a question. i've searched the newsgroup but i
apologize if i'm overlooking a post.
i work for a school, and i have tables for students, courses, and a m-
m called studentcourses. i'm building an enrollment page that will
take in a courseid and show enrolled and available students like:
enrolled
billy
suzy
available
john
jenny
and when you click on available, they bounce up to enrolled. this is
all working fine.
now it's time to update studentcourses based on the students in the
enrolled section. i grab them using jquery and i'm successfully
sending ids that are being parsed into a list by a web2py function.
but what i can't figure out is how to properly update the database to
handle that. should i be making a SQLFORM (that never gets viewed)?
should i be writing custom SQL like i'm used to in other apps?
currently the controller function just looks like this:
def enrollmentupdate():
ids =
request.vars.id
return ids
where ids is a list like ['1','3']. eventually i will just return a 1
or 0 to indicate success. but somewhere before that i need to update
the studentcourses table (in the past i've iterated over ids and
concatenated SQL update/insert statements). does anyone have
suggestions?
thanks so much!
matt