[web2py] Re: db is not defined in other model files

2016-05-05 Thread Mirek Zvolský
I'm sorry, I read to late that you already use 'reference...' So back to previous: Add some printing or logging to see the order how the models really fire. Dne čtvrtek 5. května 2016 16:00:02 UTC+2 Mirek Zvolský napsal(a): > > Models run in alphabetical order. > > You should earlier define tabl

[web2py] Re: db is not defined in other model files

2016-05-05 Thread Vic Ding
Hi Mirek, Thanks for your kind help. I will look again into the book. On Thursday, May 5, 2016 at 4:00:02 PM UTC+2, Mirek Zvolský wrote: > > Models run in alphabetical order. > > You should earlier define tables with primary keys for joins, > and later tables with foreign keys of such joins. > >

[web2py] Re: db is not defined in other model files

2016-05-05 Thread Mirek Zvolský
Models run in alphabetical order. You should earlier define tables with primary keys for joins, and later tables with foreign keys of such joins. However if this is not possible, there is an alternative syntax for foreign keys which will help: Use 'reference joinedtable' instead of db.joinedtable

[web2py] Re: db is not defined in other model files

2016-05-05 Thread Mirek Zvolský
alphabetical order ? Will print 'db.py' < 'my_list.py' print True in that environment? And I don't know what web2py uses for alphabetical sorting of models. Try add print "db" and print "my_list" into that models to see if "my_list" really starts later. If it is well, cannot be db variable delet

[web2py] Re: db is not defined in other model files

2016-05-05 Thread Vic Ding
The issue is gone magically. This happened before, the same issue come and go. I tried to add/edit db files both locally (from web UI) and externally (PyCharm on my laptop through SSH sync), both worked fine. One other issue is I have db.py, db1.py and test_list.py as model files. In test_lis

[web2py] Re: db is not defined in other model files

2016-05-04 Thread Anthony
Does it work locally? On Wednesday, May 4, 2016 at 11:56:07 AM UTC-4, Vic Ding wrote: > > Hi all, > > I have a weird problem with web2py on apache. I created db1.py and created > defined tables in it and it works fine. I created another model, name is > my_list.py and it does not work. Error is