After restarting the system, the error seems to have gone.
After moving it to the modules folder, I imported back to the default
controller and run the function.
Let me test other functions and see how it works.
Regards

On Tue, May 29, 2018 at 9:30 PM, Anthony <[email protected]> wrote:

> 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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/web2py/DcxQVaPmn9A/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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.

Reply via email to