Some of the information here may be outdated, please check the book instead
[edit]
def changelastn():
  #
  #     Given a model named mod2 , and a table named tbusers,
  #     that has fields called firstn and lastn ,
  #     here's how you can update the field named lastn so it
  #     will contain the name Brown
  # 
  #     Sterling Hankins 05/23/2008
  #
  mod2(mod2.tbusers.firstn=='Susan').update(lastn='Brown')
  response.flash = 'Changed the field named lastn to Brown'
  return dict()

or

def changelastn():
  rows=mod2(mod2.tbusers.firstn=='Susan').select()
  for row in rows: row.update_record(lastn='Brown')
  response.flash = 'Changed the field named lastn to Brown'
  return dict()
© 2008-2010 by Massimo Di Pierro - All rights reserved - Powered by web2py - design derived from a theme by the earlybird
The content of this book is released under the Artistic License 2.0 - Modified content cannot be reproduced.