当前位置: 首页>>代码示例>>Python>>正文


Python Blog.get方法代码示例

本文整理汇总了Python中models.Blog.get方法的典型用法代码示例。如果您正苦于以下问题:Python Blog.get方法的具体用法?Python Blog.get怎么用?Python Blog.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.Blog的用法示例。


在下文中一共展示了Blog.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: api_delete_blog

# 需要导入模块: from models import Blog [as 别名]
# 或者: from models.Blog import get [as 别名]
def api_delete_blog(blog_id):
    check_admin()
    blog = Blog.get(blog_id)
    blog = Blog.get(blog_id)
    if blog is None:
        raise APIResourceNotFoundError("Blog")
    blog.delete()
    return dict(id=blog_id)
开发者ID:cnu4,项目名称:awesome-blog,代码行数:10,代码来源:urls.py

示例2: blog

# 需要导入模块: from models import Blog [as 别名]
# 或者: from models.Blog import get [as 别名]
def blog(blog_id):
	blog = Blog.get(blog_id)
	if blog is None:
		raise notfound()
	blog.html_content = markdown2.markdown(blog.content) # change content to html form
	comments = Comment.find_by('where blog_id=? order by created_at desc limit 1000', blog_id)
	return dict(blog=blog, comments=comments, user=ctx.request.user)
开发者ID:dasbindus,项目名称:my-python-webapp,代码行数:9,代码来源:urls.py

示例3: api_delete_blog

# 需要导入模块: from models import Blog [as 别名]
# 或者: from models.Blog import get [as 别名]
def api_delete_blog(bid):
#    check_admin()
    blog = Blog.get(bid)
    if blog is None:
        raise APIResourceNotFoundError('Blog not found')
    blog.delete()
    return dict(id=bid)
开发者ID:ljlok,项目名称:awesome-py-webapp,代码行数:9,代码来源:urls.py

示例4: api_edit_blog

# 需要导入模块: from models import Blog [as 别名]
# 或者: from models.Blog import get [as 别名]
def api_edit_blog(id):
    check_admin()
    i = ctx.request.input()
    logging.info(i)
    title = i.title.strip()
    content = i.content.strip()
    image = i.image
    tags = i.tags
    try:
        tag_checkbox = ctx.request.gets('tag_checkbox')
    except KeyError:
        tag_checkbox = []
    logging.info("##################")
    logging.info(tag_checkbox)
    if not title:
        raise APIValueError('name', 'name cannot be empty.')
    if not content:
        raise APIValueError('content', 'content cannot be empty.')
    blog = Blog.get(id)
    if not blog:
        raise notfound()
    blog.title = title
    blog.content = content
    if image:
        delete_upload(blog.image)
        filename = upload(image)
        blog.image = filename
    blog.update()
    update_tags(blog,tag_checkbox,tags.split(' '))
    raise seeother('/blog/%s' % blog.id)
开发者ID:lixiangbest,项目名称:jblog,代码行数:32,代码来源:urls.py

示例5: manage_blogs_edit

# 需要导入模块: from models import Blog [as 别名]
# 或者: from models.Blog import get [as 别名]
def manage_blogs_edit(blog_id):
    '''管理_修改日志页 GET VIEW'''
    blog = Blog.get(blog_id)
    if blog is None:
        raise notfound()
    print 'GET VIEW /manage/blogs/edit/:blog_id dict = %s' % dict(id=blog.id, name=blog.name, summary=blog.summary, content=blog.content, action='/api/blogs/%s' % blog_id, redirect='/manage/blogs', user=ctx.request.user)
    return dict(id=blog.id, name=blog.name, summary=blog.summary, content=blog.content, action='/api/blogs/%s' % blog_id, redirect='/manage/blogs', user=ctx.request.user)
开发者ID:love123i,项目名称:awesome-python-webapp,代码行数:9,代码来源:urls.py

示例6: blog

# 需要导入模块: from models import Blog [as 别名]
# 或者: from models.Blog import get [as 别名]
def blog(blog_id):
    blog = Blog.get(blog_id)
    if blog is None:
        raise notfound()
    #对从数据库中查出的blog内容进行makedown语法格式化
    blog.html_content = markdown2.markdown(blog.content)
    comments = Comment.find_by('where blog_id=? order by created_at desc limit 100', blog_id)
    return dict(blog=blog, comments=comments, user=ctx.request.user)
开发者ID:akicqi,项目名称:python_mini_blog,代码行数:10,代码来源:urls.py

示例7: api_delete_blog

# 需要导入模块: from models import Blog [as 别名]
# 或者: from models.Blog import get [as 别名]
def api_delete_blog(blog_id):
    '''删除日志 POST API'''
    check_admin()
    blog = Blog.get(blog_id)
    if blog is None:
        raise APIResourceNotFoundError('Blog')
    blog.delete()
    return dict(id=blog_id)
开发者ID:love123i,项目名称:awesome-python-webapp,代码行数:10,代码来源:urls.py

示例8: blog

# 需要导入模块: from models import Blog [as 别名]
# 或者: from models.Blog import get [as 别名]
def blog(blog_id):
    import pdb
    pdb.set_trace()
    blog = Blog.get(blog_id)
    if blog is None:
        raise notfound()
    blog.html_content = markdown2.markdown(blog.content)
    comments = Comment.find_by('where blog_id=? order by created_at desc limit 1000',blog_id)
    return dict(blog=blog, comments=comments, user=ctx.request.user)
开发者ID:danolphoenix,项目名称:awesome-python-webapp,代码行数:11,代码来源:urls.py

示例9: tasks_sync_click

# 需要导入模块: from models import Blog [as 别名]
# 或者: from models.Blog import get [as 别名]
def tasks_sync_click():
    keys = kv.get("dirty").split(" ")
    keys = [k for k in keys if k]
    dirty = kv.get_multi(keys)
    for k, v in dirty.iteritems():
        print "key: %s,value: %d\n" % (k, v)
        blog = Blog.get(k)
        blog.click = v
        blog.update()
    kv.replace("dirty", "")
开发者ID:ZhQYuan,项目名称:jblog,代码行数:12,代码来源:urls.py

示例10: blog

# 需要导入模块: from models import Blog [as 别名]
# 或者: from models.Blog import get [as 别名]
def blog(id):
    blog = Blog.get(id)
    if not blog:
        raise notfound()
    blog.content = markdown2.markdown(blog.content,extras=["code-friendly"])
    if 'SERVER_SOFTWARE' not in os.environ:
        blog.image = '/'+blog.image
    tags = get_tags_from_blog(blog)
    blog.tags = tags
    tags = all_tags()
    return dict(blog=blog,user=ctx.request.user,tags=tags)
开发者ID:lixiangbest,项目名称:jblog,代码行数:13,代码来源:urls.py

示例11: generate_initial_data

# 需要导入模块: from models import Blog [as 别名]
# 或者: from models.Blog import get [as 别名]
 def generate_initial_data(self):
     blog=Blog.get()
     dict={
          'title':blog.title,
          'subtitle':blog.subtitle,
          'blognotice':blog.blognotice,
          'sitekeywords':blog.sitekeywords,
          'sitedescription':blog.sitedescription,
          'email':blog.email 
     }
     return dict
开发者ID:Spoylerman,项目名称:libaoyinblog,代码行数:13,代码来源:forms.py

示例12: get_form_object

# 需要导入模块: from models import Blog [as 别名]
# 或者: from models.Blog import get [as 别名]
 def get_form_object(self):
     if not self.is_valid():
         raise ValueError("valid forms")
     blog = Blog.get()
     blog.title=self.cleaned_data['title']
     blog.subtitle=self.cleaned_data['subtitle']
     blog.blognotice=self.cleaned_data['blognotice']
     blog.sitekeywords=self.cleaned_data['sitekeywords']
     blog.sitedescription=self.cleaned_data['sitedescription']
     blog.email=self.cleaned_data['email']
     return blog
开发者ID:Spoylerman,项目名称:libaoyinblog,代码行数:13,代码来源:forms.py

示例13: delete_blog

# 需要导入模块: from models import Blog [as 别名]
# 或者: from models.Blog import get [as 别名]
def delete_blog(id):
    check_admin()
    blog = Blog.get(id)
    if not blog:
        raise notfound()
    tags = get_tags_from_blog(blog)
    remove = [tag.id for tag in tags]
    remove_blogtag(blog,remove)
    delete_upload(blog.image)
    blog.delete()
    return {'data':'/'}
开发者ID:lixiangbest,项目名称:jblog,代码行数:13,代码来源:urls.py

示例14: show

# 需要导入模块: from models import Blog [as 别名]
# 或者: from models.Blog import get [as 别名]
def show(request, key):
    context = base_context()
    blog = Blog.get(key)
    if not admin():
        blog.browsed_count += 1
        blog.put()
    comments = blog.comment_set.order("date")
    form = CommentForm()
    context.blog = blog
    context.comments = comments
    context.form = form
    template = loader.get_template("blogs/show.html")
    return HttpResponse(template.render(context))
开发者ID:proming,项目名称:myblogongae,代码行数:15,代码来源:views.py

示例15: manage_blogs_edit

# 需要导入模块: from models import Blog [as 别名]
# 或者: from models.Blog import get [as 别名]
def manage_blogs_edit(blog_id):
    blog = Blog.get(blog_id)
    if blog is None:
        raise notfound()
    return dict(
        id=blog.id,
        name=blog.name,
        summary=blog.summary,
        content=blog.content,
        action="/api/blogs/%s" % blog_id,
        redirect="/manage/blogs",
        user=ctx.request.user,
    )
开发者ID:skyoskiyqq,项目名称:JnswWebApp,代码行数:15,代码来源:urls.py


注:本文中的models.Blog.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。