So i'm following the 'simple wiki' guide in the web2py manual , and despite following the exact steps give , i'm getting a syntax error in the following , line 17 :
db = DAL('sqlite://storage.sqlite')
from gluon.tools import *
auth=Auth(db)
auth.define_tables()
crid=Crud(db)
db.define_table('page',
Field('recipe_name'),
Field('recipe_body','text'),
Field('created_on','datetime',default=request.now),
Field('created_by','reference auth_user',default=auth.user_id),
format='%(recipe_name)s')
db.define_table('comments',
Field('recipe_id', 'reference page'),
Field('comment_body','text'),
Field('created_on','datetime',default=request.now)
Field('created_by','reference auth_user', default=auth.user_id))
db.define_table('image',
Field('recipe_id','reference page'),
Field('name'),
Field('file','upload'),
Field('created_on', 'datetime', default=request.now),
Field('created_by', 'reference auth_user', default=auth.user_id),
format='%(name)s')
db.page.recipe_name.requires=IS_NOT_IN_DB(db, 'page.recipe_name')
db.page.recipe_body.requires=IS_NOT_EMPTY()
db.page.created_by.readable = db.page.created_by.writable = False
db.page.created_on.readable = db.page.created_on.writable = False
db.comments.comment_body.requires = IS_NOT_EMPTY()
db.comments.recipe_id.readable = db.comments.recipe_id.writable = False
db.comments.created_by.readable = db.comments.created_by.writable = False
db.comments.created_on.readable = db.comments.created_on.writable = False
db.image.name.requires = IS_NOT_IN_DB(db, 'image.name')
db.image.page_id.readable = db.image.recipe_id.writable = False
db.image.created_by.readable = db.image.created_by.writable = False
db.image.created_on.readable = db.image.created_on.writable = False
~
~
~
The error is under define_table('comments', on the line :
Field('created_by','reference auth_user', default=auth.user_id))
The error is worded as : (invalid syntax (db.py, line 17))
Please do help me out!
Aucun commentaire:
Enregistrer un commentaire