daily pastebin goal
41%
SHARE
TWEET

Untitled

a guest Jun 14th, 2018 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def index():
  2.     redirect(URL(r=request, f='shouts'))
  3.  
  4.  
  5. def shouts():
  6.  
  7.     form = SQLFORM(db.shout, fields=['body','category'])
  8.    
  9.     if form.accepts(request.vars, session):
  10.         redirect(URL(r=request, f='shouts'))
  11.    
  12.     if form.errors: response.flash = 'Oops! Try that again'
  13.    
  14.     rows = db().select(db.shout.ALL)
  15.    
  16.     return dict(form=form, shouts=rows)
  17.  
  18. def show():
  19.     id = request.vars.id
  20.     rows = db(db.shout.id==id).select()
  21.    
  22.     if len(rows)==0:
  23.         redirect(URL(r=request, f='shouts'))
  24.     return dict(shout=rows[0])
  25.    
  26.    
  27. ##NEW SHOUT    
  28. @auth.requires_login()
  29. def newshout():
  30.  
  31.     form = SQLFORM(db.shout, fields=['body','category'])
  32.    
  33.     if form.accepts(request.vars, session):
  34.         redirect(URL(r=request, f='shouts'))
  35.    
  36.     if form.errors: response.flash = 'Oops! Try that again'
  37.    
  38.     return dict(form=form)
  39.  
  40.  
  41. # # uncomment the following if you have defined "auth" and "crud" in models
  42. def user(): return dict(form=auth())
  43. def data(): return dict(form=crud())
  44. # def download(): return response.download(request,db)
  45. # # tip: use @auth.requires
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top