Nevermind, it was because I initialized my module in a controller and not a model.
On Tuesday, July 22, 2014 11:21:39 AM UTC+2, Ruud Schroen wrote: > > Hi guys, > > I'm building a Blog module, which I will post here as soon as it's done. > But there's something wrong, I've defined a couple of tables in the module. > > def define_tables(self): > category_tablename = self.settings.category_tablename > post_tablename = self.settings.post_tablename > link_tablename = self.settings.link_tablename > comment_tablename = self.settings.comment_tablename > > self.blog_category = self.db.define_table(category_tablename, > Field("name", label=self.T("Name of the category")), > Field("slug", compute=lambda r: IS_SLUG()("%s" % > (r["name"]))[0]), > Field("description", 'text', label=self.T('Describe what > will be inside this category')) > ) > > self.blog_post = self.db.define_table(post_tablename, > Field("title", label=self.T("Name the title of this > post")), > Field("slug", compute=lambda r: IS_SLUG()("%s" % > (r["title"]))[0]), > Field('body', 'text', label=self.T('The content of this > post')), > self.auth.signature > ) > > self.post_category_link = self.db.define_table(link_tablename, > Field('post_id', 'reference %s' % post_tablename), > Field('category_id', 'reference %s' % category_tablename), > Field('is_active', 'boolean', default=True) > ) > > self.blog_comment = self.db.define_table(comment_tablename, > Field('post_id', 'reference %s' % post_tablename), > Field('parent_comment', 'reference %s' % > comment_tablename), > Field('author', label=self.T('Your name')), > Field('body', 'text', label=self.T('Your comment')), > ) > > #Creates an admin role if there is none > if self.db(self.db.auth_group.role == 'admin').count() == 0: > self.db.auth_group.insert(role='admin') > > #Virtual field which keeps track of the category links of each post > #Allows for an easy way of showing the post's categories in the > views > self.blog_post.categories = Field.Virtual('categories', lambda > row: self.category_field(row)) > > The tables ARE created because when I do "self.db.tables()", this is my > output: > auth_userauth_groupauth_membershipauth_permissionauth_eventauth_cas > blog_categoryblog_postpost_to_categoryblog_comment > > However.. the tables do not show up in appadmin, why? > -- 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.