If you moved the model-definition code to a module, what does that look
like? Also, where do you import the module and call the model-defining
function/class?
Anthony
On Tuesday, May 29, 2018 at 8:11:41 AM UTC-4, Maurice Waka wrote:
>
> I moved some of my code from controller to my modules but now am getting
> this error:
>
> if db(db.post).isempty():
> File "/usr/local/lib/python2.7/dist-packages/pydal/base.py", line 669, in
> __getattr__
> return BasicStorage.__getattribute__(self, key)
> AttributeError: 'DAL' object has no attribute 'post'
>
>
> This is the code:
> model:
> db.define_table('post',
> Field('author', 'reference auth_user', default=auth.user_id
> , writable=False, readable=False),
>
>
> controller:
> if db(db.post).isempty():
> db.post.insert(message="Hi, it's" +' ' +auth.user.first_name+' '+
> 'loging
> in...')
> form = SQLFORM(db.post, formstyle='table3cols',)
>
> Where could I be wrong on this?
>
> Regards
>
--
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.