Hi All, I now this should have been probably answered before but I wasn't able to find a solution and since I'm newbie I'm not able to understand why this is not working as I expect.
I've tried many things and now I'm giving up after trying to simulate the Movuca schema which I liked. Here's the issue: I'm getting following error AttributeError: 'DAL' object has no attribute 'region' And here's the code: db.py is the default but I only added this: from gluon import current current.myapp = Storage() current.myapp.db = db In controllers/defaul.py from Region import Region from Country import Country from gluon.storage import Storage def region(): region = Region() region.set_properties() region.define_table() region.insertar() regions=region.listar() return dict(regions=regions) def country(): country = Country() country.set_properties() country.define_table() country.insertar() country=country.listar() return dict(country=country) in modules/Region.py from gluon import * from gluon import current class Region(object): tablename = 'region' format = "%(region)s" def __init__(self): self.db = current.myapp.db def set_properties(self): self.fields = [ # main Field("author", "reference auth_user"), Field("region", "string"), Field("description", "text"), ] def define_table(self): self.db.define_table(self.tablename, *self.fields, **dict(format=self.format)) self.db.commit() def insertar(self): self.db.region.insert(region = 'Region1') def listar(self): db=self.db regions=db(db.region.id>0).select(orderby=db.region.region) return regions in modules/Country.py from gluon import * from gluon import current class Country(object): tablename = 'country' format = "%(country)s" def __init__(self): self.db = current.myapp.db def set_properties(self): self.fields = [ # main Field("author", "reference auth_user"), Field("region", "reference region"), Field("country", "string"), Field("description", "text"), ] def define_table(self): self.db.define_table(self.tablename, *self.fields, **dict(format=self.format)) self.db.commit() def insertar(self): self.db.region.insert(country = 'RegionA',region= 1) def listar(self): db=self.db country=db(db.country.id>0).select(orderby=db.country.region) return country I can see the tables regions and country created but I do not understand why when I insert country I'm having this error. First region of the default controller and then country of the default controller. Regards and thanks for helping -- --- 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/groups/opt_out.