db.define_table('articles',
Field('article_date', 'date'),
Field('article_title'),
Field('article_link', compute=lambda r: r.article_title.replace(' ', '-')),
Field('image', 'upload'),
Field('body', 'text'))
def index():
return dict()
def articles()
article = db(db.articles.article_link==request.args[0]).select()[0]
return dict(article=article)
I want to use manage and grid functions to edited the articles table
so records should to editable after insertion.
@auth.requires_membership('admin')
def manage():
grid=SQLFORM.grid(db.articles, editargs=dict(fields=['article_date','article_title','article_link','image','body']))
return grid
@auth.requires_membership('admin')
def grid():
response.view = 'generic.html'
tablename = request.args(0)
if not tablename in db.tables: raise HTTP(403)
grid = SQLFORM.smartgrid(db[tablename], args=[tablename], deletable=False, editable=True)
return dict(grid=grid)
With the compute function on the table the SQLFORM.grid or smartgrid records can not be updated.