-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathblog.py
41 lines (34 loc) · 1.04 KB
/
blog.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# -*- coding: utf-8 -*-
# try something like
def index(): return dict(message="hello from blog.py")
def update():
record = db.blog(request.args(0)) or redirect(URL('post'))
form = SQLFORM(db.blog, record)
if form.process().accepted:
response.flash = T('record Updated')
else:
response.flash = T('Please complete the form.')
return locals()
def display_form():
form = SQLFORM(db.blog)
if form.process().accepted:
session.flash = 'form accepted'
redirect(URL('thanks'))
elif form.errors:
response.flash = 'form has errors'
return locals()
def thanks():
msg = "Thank you for submitting your post"
return locals()
@auth.requires_membership('blog_poster')
def post():
form = SQLFORM(db.blog).process()
return locals()
@auth.requires_membership('blog_poster')
def post():
form = SQLFORM(db.blog).process()
return locals()
@auth.requires_login()
def view():
rows = db(db.blog).select(orderby=~db.blog.id)
return locals()