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


Python Blog.get方法代码示例

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


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

示例1: index

# 需要导入模块: from blog.models import Blog [as 别名]
# 或者: from blog.models.Blog import get [as 别名]
def index(request):
    page=request.GET.get('page',1)
    page = int(page)
    entrys = Entry.objects.get_posts()
    categories=Category.objects.all()
    comments=Comment.objects.in_public().exclude(email=Blog.get().email)[:8]
    return render_response(request,'wap/index.html',locals())
开发者ID:Spoylerman,项目名称:libaoyinblog,代码行数:9,代码来源:wap.py

示例2: GET

# 需要导入模块: from blog.models import Blog [as 别名]
# 或者: from blog.models.Blog import get [as 别名]
 def GET(self):
     from util.feedgenerator import Atom1Feed
     
     blog = Blog.get()
     blog_home = web.ctx.home
     feed = Atom1Feed(
         title=blog.name,
         link=blog_home,
         description=blog.description,
     )
     posts = Post.all().filter('hidden =', False).order('-date').fetch(10)
     for post in posts:
         if post.category:
             category = (post.category.name,)
         else:
             category = ()
         if post.tags:
             category = category + tuple(post.tags)
         feed.add_item(title=post.title,
                       link=blog_home + post.getUrl(),
                       description=post.content,
                       pubdate=post.date,
                       categories=category
                       )
     web.header('Content-Type', 'application/atom+xml')
     return feed.writeString('utf-8')
开发者ID:yinzhigang,项目名称:diarytype,代码行数:28,代码来源:__init__.py

示例3: GET

# 需要导入模块: from blog.models import Blog [as 别名]
# 或者: from blog.models.Blog import get [as 别名]
 def GET(self):
     """系统设置表单"""
     import pytz
     common_timezones = pytz.common_timezones
     blog = Blog.get()
     
     return render('admin/setting.html',blog=blog,timezones=common_timezones)
开发者ID:yinzhigang,项目名称:diarytype,代码行数:9,代码来源:admin.py

示例4: POST

# 需要导入模块: from blog.models import Blog [as 别名]
# 或者: from blog.models.Blog import get [as 别名]
 def POST(self):
     """保存模板装饰布局"""
     data = web.data()
     blog = Blog.get()
     blog.theme_widget = data
     blog.update()
     
     return json.dumps({'status': 'ok'})
开发者ID:yinzhigang,项目名称:diarytype,代码行数:10,代码来源:admin.py

示例5: single

# 需要导入模块: from blog.models import Blog [as 别名]
# 或者: from blog.models.Blog import get [as 别名]
def single(request,id=None):
    id=int(id)
    page=request.GET.get('page',1)
    page=int(page)
    entry=Entry.objects.get(id=id)
    comments=entry.comments.in_public().exclude(email=Blog.get().email)
    comments = paginator(comments,10,page)
    return render_response(request,'wap/single.html',{'entry':entry,'comments':comments})
开发者ID:Spoylerman,项目名称:libaoyinblog,代码行数:10,代码来源:wap.py

示例6: recentComments

# 需要导入模块: from blog.models import Blog [as 别名]
# 或者: from blog.models.Blog import get [as 别名]
def recentComments(request,page=1):
    page=request.GET.get('page',1)
    page = int(page)
    allcomment=Comment.objects.exclude(email=Blog.get().email).filter(is_public=True).order_by('-date')
    comments = paginator(allcomment,10,page)
    t = loadTempalte('recentcomments.html')
    html = t.render(Context({'comments': comments}))
    json = simplejson.dumps((True,html))
    return HttpResponse(json)
开发者ID:Spoylerman,项目名称:libaoyinblog,代码行数:11,代码来源:views.py

示例7: index

# 需要导入模块: from blog.models import Blog [as 别名]
# 或者: from blog.models.Blog import get [as 别名]
def index(request):
    
    post_count=Entry.objects.all().filter(entrytype='post').count()
    comment_count=Comment.objects.in_public().count()
    spam_count=Comment.objects.in_moderation().count()
    page_count=Entry.objects.all().filter(entrytype='page').count()
    category_count=Category.objects.count()
    tag_count=Tag.objects.count()
    comments=Comment.objects.all().exclude(email=Blog.get().email).filter(is_public=True).order_by('-date')[:10]
    return render_response(request,"admin/index.html",locals())
开发者ID:zhigoo,项目名称:youflog,代码行数:12,代码来源:admin.py

示例8: on_comment_was_submit

# 需要导入模块: from blog.models import Blog [as 别名]
# 或者: from blog.models.Blog import get [as 别名]
def on_comment_was_submit(sender,comment,*args,**kwargs):
    blog=Blog.get()
    domain="http://%s"%(Site.objects.get_current().domain)
    if comment.parent_id != '0':
        old_c=comment.parent
        emailtitle=u'您在 '+blog.title+u' 上的评论有了新的回复'
        if old_c.mail_notify:
            sendmail('email/reply_comment.txt',{'old':old_c,"comment":comment,
                                'blog':blog,'domain':domain},
                      emailtitle,old_c.email)
    else:
        comments_notify=OptionSet.get('comments_notify',1)
        if int(comments_notify) == 1 and comment.is_public==True:
            emailtitle=u'文章'+comment.object.title+u'有了新的评论'
            sendmail('email/new_comment.txt',{'comment':comment,'domain':domain},emailtitle,blog.email)
开发者ID:Spoylerman,项目名称:libaoyinblog,代码行数:17,代码来源:signals.py

示例9: get_reader_wall

# 需要导入模块: from blog.models import Blog [as 别名]
# 或者: from blog.models.Blog import get [as 别名]
def get_reader_wall(context,number=10):
    comments=cache.get_cache('sidebar:readerwall')
    if not comments:
        admin_email=Blog.get().email
        sql="select count(email) as count,author,email,weburl from comments_comment where is_public=1 and email !='%s' group by email order by count desc limit %d"%(admin_email,number)
        cursor = connection.cursor()
        cursor.execute(sql)
        rows=cursor.fetchall()
        comments=[]
        
        for row in rows:
            count=row[0]
            author=row[1]
            email=row[2]
            weburl=row[3]
            comment={'author':author,'weburl':weburl,'count':str(count),'email':email}
            comments.append(comment)
        cache.set_cache('sidebar:readerwall',comments,30)
    return {'comments':comments}
开发者ID:Spoylerman,项目名称:libaoyinblog,代码行数:21,代码来源:sidebar.py

示例10: __init__

# 需要导入模块: from blog.models import Blog [as 别名]
# 或者: from blog.models.Blog import get [as 别名]
 def __init__(self):
     self.blog = Blog.get()
开发者ID:yinzhigang,项目名称:diarytype,代码行数:4,代码来源:base_front.py

示例11: side

# 需要导入模块: from blog.models import Blog [as 别名]
# 或者: from blog.models.Blog import get [as 别名]
def side(request):
    blog=Blog.get()
    site=Site.objects.get_current()
    return locals()
开发者ID:Spoylerman,项目名称:libaoyinblog,代码行数:6,代码来源:youflogprocessor.py

示例12: blogger_getUsersBlogs

# 需要导入模块: from blog.models import Blog [as 别名]
# 或者: from blog.models.Blog import get [as 别名]
def blogger_getUsersBlogs(appkey, username, password):
    _checkUser(username,password)
    blog=Blog.get()
    url='http://%s'%(Site.objects.get_current().domain)
    return [{'url' : url, 'blogid' : '1','isAdmin':True, 'blogName' : blog.title,'xmlrpc':url+"/rpc"}]
开发者ID:Spoylerman,项目名称:libaoyinblog,代码行数:7,代码来源:rpc.py

示例13: get_recent_comment

# 需要导入模块: from blog.models import Blog [as 别名]
# 或者: from blog.models.Blog import get [as 别名]
def get_recent_comment(context,number=10):
    comments=Comment.objects.in_public().exclude(email=Blog.get().email)
    return {'comments':comments[:number]}
开发者ID:Spoylerman,项目名称:libaoyinblog,代码行数:5,代码来源:sidebar.py


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