Hi all, I've been following Massimo's video tutorials <http://vimeo.com/76047107>(which are *great!* thanks Massimo)
when trying to build the reddit clone and populate it i get a ticket - <class 'sqlite3.IntegrityError'> foreign key constraint failed the database was populated with users and posts but not with comments. I tried to make sure my code is exactly as the code Massimo showed but /w no success. any suggestions? db.define_table('category', Field('name', requires = (IS_SLUG(), IS_LOWER(), IS_NOT_IN_DB(db, 'category.name')))) db.define_table('post', Field('category', 'reference category', readable=False, writable=False), Field('title', 'string', requires=IS_NOT_EMPTY()), Field('url', requires=IS_EMPTY_OR(IS_URL())), Field('body', 'text', requires=IS_NOT_EMPTY()), Field('votes', 'integer', default=0, readable=False, writable=False), auth.signature) # created_on, created_by, modified_on, modified_by, is_active db.define_table('post_vote', Field('post', 'reference post'), Field('score', 'integer', default=+1), # numerical representation of votes auth.signature) db.define_table('comm', Field('post', 'reference post'), Field('parent_comm', 'reference comm'), Field('votes', 'integer'), Field('body', 'text'), auth.signature) db.define_table('comm_vote', Field('comm', 'reference comm'), Field('score', 'integer', default=+1), # numerical representation of votes auth.signature) from gluon.contrib.populate import populate if db(db.auth_user).count()<2: populate(db.auth_user, 100) db.commit() if db(db.post).count()<2: populate(db.post, 500) db.commit() if db(db.comm).count()<2: populate(db.comm, 1000) db.commit() -- 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.