Sorry, I'm a bit confused. I'm under the impression the db=DAL(...) line
simply tells web2py which database I will be using. Then I use
db.define_table to create the table. All of this seems to work because I
do see the table listed within the databases directory. When I try and
reference it however I get the error. As far as I can tell there is only
one reference to db=DAL(...) in my code.
On Sunday, March 15, 2015 at 4:24:15 PM UTC-5, pumplerod wrote:
>
> I've found others with this similar error, however the solutions don't
> seem to apply as far as I can tell in my simplified instance...
>
> # db.py
> db = DAL('sqlite://storage.sqlite')
> db.define_table('brands',
> Field('brand_name', type='string', requires=IS_NOT_EMPTY(),
> label=T('brand_name')),
> migrate=True)
>
> # in the controller.py
> def brand():
> form = SQLFORM(db.brands)
> return dict(form=form)
>
> # in the brand.html
> {{extend 'layout.html'}}
> <h2>{{=T( request.args(0).replace('_',' ').capitalize() )}}</h2>
> <div id="brand_form">
> {{
> =form
> }}
> </div>
>
> I get this error:
>
> AttributeError: 'DAL' object has no attribute 'brands'
>
>
> I think I've boiled this down as simple as I can. the table does indeed
> exist. I'm sure I'm missing something very basic.
>
>
--
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.