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. > > However if this is not possible, > there is an alternative syntax for foreign keys which will help: > Use > 'reference joinedtable' > instead of > db.joinedtable > > See web2py.com/book, chapter 6, "Self-Reference and aliases" for details. > > > > > Dne čtvrtek 5. května 2016 15:20:50 UTC+2 Vic Ding napsal(a): >> >> 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_list.py I defined a table which is referenced in db1.py. >> db1.py >> >> db.define_table('customer', >> auth.signature, >> Field('name','string',requires=IS_NOT_EMPTY()), >> Field('address1','string',requires=IS_NOT_EMPTY()), >> >> format='%(name)s' >> ) >> >> test_list.py >> >> db.define_table('country_list2', >> Field('name'), >> Field('test','reference customer') >> ) >> >> >> I get a complain that "Cannot resolve reference customer in >> country_list2 definition". Is there a better way to organise the model >> files? Does this mean that the model files are loaded in alphabetical >> order? >> >> Thanks in advance >> >> Vic >> >> >> >> On Wednesday, May 4, 2016 at 6:09:29 PM UTC+2, Anthony wrote: >>> >>> 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 db is not defined in >>>> my_list.py. Any idea what the problem might be? >>>> Thanks! >>>> >>> -- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.