Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def index():
- redirect(URL(r=request, f='shouts'))
- def shouts():
- form = SQLFORM(db.shout, fields=['body','category'])
- if form.accepts(request.vars, session):
- redirect(URL(r=request, f='shouts'))
- if form.errors: response.flash = 'Oops! Try that again'
- rows = db().select(db.shout.ALL)
- return dict(form=form, shouts=rows)
- def show():
- id = request.vars.id
- rows = db(db.shout.id==id).select()
- if len(rows)==0:
- redirect(URL(r=request, f='shouts'))
- return dict(shout=rows[0])
- ##NEW SHOUT
- @auth.requires_login()
- def newshout():
- form = SQLFORM(db.shout, fields=['body','category'])
- if form.accepts(request.vars, session):
- redirect(URL(r=request, f='shouts'))
- if form.errors: response.flash = 'Oops! Try that again'
- return dict(form=form)
- # # uncomment the following if you have defined "auth" and "crud" in models
- def user(): return dict(form=auth())
- def data(): return dict(form=crud())
- # def download(): return response.download(request,db)
- # # tip: use @auth.requires
Add Comment
Please, Sign In to add comment