Thanks Anthony! All the db tables were defined in separate model files, which is what I would prefer, but as a last attempt to resolve the conflict I moved them all to a single models.py model file and arranged a few of the declarations to avoid that error. It is working now but I would have preferred the models in separate files, but maybe that's not possible when they have so many foreign keys.
Is it possible to stage the order which the model files are read so table declarations will be in the right sequence? On Sunday, August 28, 2016 at 8:41:17 PM UTC-4, Brian Boatright wrote: > > I've tried adding a model for "Containers" and "ContainerTypes" each time > I get an error when it tries to create the tables when I click the Database > Admin button. > > The other tables I'm defining are working fine. I have a few other tables > that have "Type" in their mode/table name so when I couldn't create > "containers" table. > > I've looked at MySQL and MariaDB (which I'm using) and do not see > "container" or something similar listed as a reserved word. > > here is the error > > <type 'exceptions.NameError'> name 'db' is not defined > > > db.define_table('containers', > Field('parentid','reference containers'), > Field('name','string')) > > *Traceback (most recent call last):* > >> File "C:\dev\web2py\gluon\restricted.py", line 227, in restricted >> exec ccode in environment >> File "C:/dev/web2py/applications/partsbin/models/containers.py", line >> 2, in <module> >> db.define_table('containers', >> NameError: name 'db' is not defined > > -- 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.