I want to use update_or_insert to insert a value to my DB if it doesn't
exist.
def add_name():
form = SQLFORM(db.name)
if form.process().accepted:
db.name.update_or_insert(db.name.name==request.vars.name,
name=request.vars.name)
return dict(form=form)
But it won't work. Names are also added to the DB, even if they already
there.
Thanks for your help!
- Andreas
--
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/groups/opt_out.