Hello everyone,
I'm developing a simple database app locally with SQLite. Everything
works great. When I push to the server, it's using Postgres and when I
do this:
...
def update():
recordId = request.vars.id
updatedField = request.vars.updatedField
updatedData = request.vars.updatedData
row = (db.part.id == recordId)
if updatedField == 'part_Number':
db(row).update(part_Number = updatedData)
...
The row updates fine, but isn't visible with a:
db().select(db.part.ALL)
I can go into web2py's database admin and point directly to a row's ID
and it pulls up fine, it just doesn't show up with the rest of the
rows on a SELECT ALL. I can also use pgAdmin3 (postgres admin tool for
Mac) and see the data fine. I've also tried doing a:
db.part[recordId].update_record(part_Number = updatedData)
But it has the same effect. So my questions are as follows:
1) What am I doing wrong with the above?
2) What's the difference between an update and an update_record?
3) With the above example, is there anyway I can use a variable for a
field name? So instead of having a bunch of if's and elif's to go
through the field, I could do a:
db(row).update(updatedField = updatedData)
Thanks!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---