本文整理汇总了Python中model.get_post函数的典型用法代码示例。如果您正苦于以下问题:Python get_post函数的具体用法?Python get_post怎么用?Python get_post使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_post函数的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: POST
def POST(self, post_id):
if not session.admin:
authorization_error()
post_id = int(post_id)
post = model.get_post(post_id)
if not model.authorized_user(session.userId, post.contactId):
authorization_error()
form = self.form()
if not form.validates():
post = model.get_post(post_id)
return render.newitem(post, form)
for idx in range(int(form.d.count)):
model.new_help_item(post_id, utils.standardize_date(form.d.date), form.d.description)
raise web.seeother('/view/%d' % post_id)
开发者ID:mongi3,项目名称:icanhelp,代码行数:14,代码来源:code.py
示例2: GET
def GET(self, id):
if not session.admin:
authorization_error()
post = model.get_post(int(id))
if not model.authorized_user(session.userId, post.contactId):
authorization_error()
return render.delete(post)
开发者ID:mongi3,项目名称:icanhelp,代码行数:7,代码来源:code.py
示例3: GET
def GET(self, id):
"""
show single post
"""
post = model.get_post(int(id))
pprint.pprint(post)
return render.view(post=post)
开发者ID:MeTrina,项目名称:webpy-1,代码行数:7,代码来源:blog.py
示例4: POST
def POST(self, id):
form = New.form()
post = model.get_post(int(id))
if not form.validates():
return render.edit(post, form)
model.update_post(int(id), form.d.title, form.d.content)
raise web.seeother('/')
开发者ID:chinesemark,项目名称:pytest1,代码行数:7,代码来源:blog.py
示例5: get_post
def get_post():
model.conn_db()
post_id = request.args.get("post_id")
print "post is: " , post_id
#need to fix this so I decide whether to search for title or id
list_posts = model.get_post(title=post_id)
print "list_posts is: " , list_posts
html = render_template("post.html",list_posts=list_posts)
return html
开发者ID:riyamodi,项目名称:Hackbright-Practice_Web_App,代码行数:9,代码来源:app.py
示例6: GET
def GET(self, id):
""" View single post """
post = model.get_post(int(id))
time = post.posted_on
time_str = str(time)
time_split = time_str.split(' ')
date = time_split[0]
time = time_split[1]
return render.view(post,date)
开发者ID:graemeb52096,项目名称:personal_site,代码行数:9,代码来源:app.py
示例7: POST
def POST(self, id):
form = New.form()
post = model.get_post(int(id))
if not form.validates():
return render.edit(post, form)
if post.user_id == auth.getUser().user_id:
model.update_post(int(id), form.d.title, form.d.content)
raise web.seeother("/")
开发者ID:ntresch,项目名称:webapp,代码行数:9,代码来源:appcode.py
示例8: POST
def POST(self, blogid):
form = self.form()
if not form.validates():
post = model.get_post(int(blogid))
comments = model.get_comments(int(blogid))
return render.view(post, comments, form)
else:
model.new_comment(blogid, form.d.author, form.d.comment)
web.seeother("/view/" + blogid)
开发者ID:friendwu,项目名称:xwp,代码行数:9,代码来源:index.py
示例9: POST
def POST(self, id):
form = New.form()
post = model.get_post(int(id))
if not form.validates():
return render.edit(post=post, form=form)
if cjutils.auth_user():
model.update_post(int(id), form.d.title, form.d.content)
raise web.seeother('/')
else:
web.setcookie('logined', 'False', 0)
开发者ID:JohnChance,项目名称:JohnnyBlog,代码行数:10,代码来源:blog.py
示例10: POST
def POST(self, id):
form = New.form()
post = model.get_post(int(id))
if not form.validates():
return render.edit(post, form)
if str(form.d.password) == '123':
model.update_post(int(id), form.d.title, form.d.content, form.d.link, form.d.link_name)
raise web.seeother('/')
else:
return render.edit(post, form)
开发者ID:graemeb52096,项目名称:personal_site,代码行数:10,代码来源:app.py
示例11: sendConfirmationEmail
def sendConfirmationEmail(item_id):
# don't even attempt if email config info has not been provided
if not web.config.smtp_username:
print "WARNING: email user/password not configured. Ignoring attempt to send confirmation email."
return
item = model.get_item(int(item_id))
# Get contact info for the help item
post_data = model.get_post(int(item.helpRequestId))
contact_data = model.get_contact_data(post_data.contactId)
item.contactName = contact_data.name
item.contactEmail = contact_data.email
item.contactPhone = contact_data.phone
item.url = "%s/view/%s" % (config.SITE_BASE, item.helpRequestId)
item.date = utils.convert_date(item.date)
if item.helpEmail:
f = web.config.smtp_username
to = item.helpEmail
cc = item.contactEmail
subject = 'Confirmation: you signed up to help on %(date)s' % item
msg = """Thanks for you willingness to help.
This email is to confirm that you signed up to help on %(date)s for the item "%(description)s". More details can be found here:
%(url)s
If you have any questions don't reply to this email. Instead contact %(contactName)s
email: %(contactEmail)s
phone: %(contactPhone)s
Thanks!""" % item
#print f, to, subject, msg
web.sendmail(f,to,subject,msg,cc=cc)
else:
# The person did not provide an email. Instead an email will be sent
# to the contact person informing them of the situation.
f = web.config.smtp_username
to = item.contactEmail
subject = 'Confirmation: Helper with no email'
msg = """%(helpName)s signed up to help on %(date)s for item
"%(description)s" but did not provide an email address.
Since no email is present, the website will be unable to provide them an automatic reminder.
Details can be found here:
%(url)s
""" % item
#print f, to, subject, msg
web.sendmail(f,to,subject,msg)
开发者ID:mongi3,项目名称:icanhelp,代码行数:51,代码来源:emailconfirm.py
示例12: GET
def GET(self, id):
""" View single post """
# TODO: make the post test render as htmnl
post = model.get_post(int(id))
user = model.getUserById(post.user_id)
comments = model.get_comments(int(id))
renderedComments = ""
if comments:
renderedComments = renderInsert.comments(comments, model)
votes = model.get_votes(id)
lUser = auth.getUser()
if lUser:
hasUserVoted = model.hasUserVoted(auth.getUser().user_id, post.id)
else:
hasUserVoted = False
return render.view(post, user, renderedComments, self.form, hasUserVoted, votes)
开发者ID:ntresch,项目名称:webapp,代码行数:16,代码来源:appcode.py
示例13: GET
def GET(self,id):
""" View single post """
form=self.form()
if id > '0' :
post = model.get_post(int(id))
glyphparam = model.get_glyphparam(int(id))
groupparam = model.get_groupparam(int(id))
form.fill(post)
posts = model.get_posts()
postspa = model.get_postspa()
formParam = self.formParam()
formParamG = self.formParamG()
if glyphparam != None :
formParam.fill(glyphparam)
if groupparam != None :
formParamG.fill(groupparam)
mastglobal = model.get_globalparam(cFont.idglobal)
master = model.get_master(cFont.idmaster)
webglyph = cFont.glyphName
return render.view(posts,post,form,formParam,formParamG,master,mastglobal,webglyph,glyphparam,groupparam,cFont,postspa)
开发者ID:davelab6,项目名称:mfg-2013,代码行数:21,代码来源:mfg.py
示例14: GET
def GET(self, id):
post = model.get_post(int(id))
form = New.form()
form.fill(post)
return render.edit(post, form)
开发者ID:chinesemark,项目名称:pytest1,代码行数:5,代码来源:blog.py
示例15: GET
def GET(self, id):
""" View single post """
post = model.get_post(int(id))
return render.view(post)
开发者ID:autumind,项目名称:blog.python,代码行数:4,代码来源:blog.py
示例16: GET
def GET(self):
web.header('Content-type','application/json')
id = web.input(_method='get').postId
post = model.get_post(int(id))
return json.dumps(post,cls=CJsonEncoder)
开发者ID:17leba,项目名称:python_moods,代码行数:5,代码来源:index.py
示例17: GET
def GET(self, id):
return render.viewpost(id, model.get_post(id), self.newReplyForm, db)
开发者ID:busterroni,项目名称:web.py-forum,代码行数:2,代码来源:app.py
注:本文中的model.get_post函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论