In the model file …/Models/db.py I have the following code
*# Connect to a local postgres instance*
* db = DAL(**"postgres://user@localhost/DBName"**)*
*# Create some fields*
* _name * *= Field(**'name'**, * *type=**'string'**, * *length=*
*'256'** )*
* _author* * = Field(**'author'**, * *type=**'string'**, * *length=*
*'256'** )*
* _created = Field(**'created'**, type=**'datetime'* * )*
*# Create a table from those fields*
* db.define_table( **'project_common'**, _name, _author, _created )*
In the controller default.py I have the following code
*# Connect to a local postgres instance*
* db = DAL(**"postgres://user@localhost/DBName"**)*
* # Insert or Update the row*
* db.project_common.update_or_insert( * *\*
* db.project_common.**name** == _**name**, \*
* name = _name, * *\*
* author = _author, * *\*
* created = _create, * *\*
* description = _description )*
But I get an error the execution of the last statement above (
*update_or_insert*) saying that *db* does not have an attribute
*project_common*
This feels like one of those posts where I am about to get pounded on for
something so basic. I am new to web2py and comparing it to some other
alternatives. Just making up silly test cases to try and experience it
before deciding what system to use. Seems like a wonderful system that
absolutely blows away PHP development, has similarities to GAE, and
tremendous simplicity to install. Very portable as well. But I am
struggling with some basics of DAL. Thanks for the help
--
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/d/optout.