本文整理汇总了Python中blog.models.Entry.popular_entries方法的典型用法代码示例。如果您正苦于以下问题:Python Entry.popular_entries方法的具体用法?Python Entry.popular_entries怎么用?Python Entry.popular_entries使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类blog.models.Entry
的用法示例。
在下文中一共展示了Entry.popular_entries方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: link
# 需要导入模块: from blog.models import Entry [as 别名]
# 或者: from blog.models.Entry import popular_entries [as 别名]
def link(request, id):
link = get_object_or_404(Link, id=id)
return render(request,
'blog/link.html',
{'item': link,
'popular_entries': Entry.popular_entries(),
# 'form': form
})
示例2: link
# 需要导入模块: from blog.models import Entry [as 别名]
# 或者: from blog.models.Entry import popular_entries [as 别名]
def link(request, id):
link = get_object_or_404(Link, id=id)
form = CommentForm(request)
if request.method == 'POST':
form = CommentForm(request, request.POST)
if form.is_valid():
comment = form.save_comment_for(link)
return HttpResponseRedirect(_comment_url(request, comment))
return render(request,
'blog/link.html',
{'item': link,
'popular_entries': Entry.popular_entries(),
'form': form})
示例3: entry
# 需要导入模块: from blog.models import Entry [as 别名]
# 或者: from blog.models.Entry import popular_entries [as 别名]
def entry(request, id, slug):
entries = Entry.objects if request.user.is_superuser else Entry.live
try:
entry = entries.get(id=id)
except Entry.DoesNotExist:
raise Http404
if slug != entry.slug:
return HttpResponseRedirect(entry.get_absolute_url())
return render(request,
'blog/entry.html',
{'item': entry,
'popular_entries': Entry.popular_entries(),
# 'form': form
})
示例4: entry
# 需要导入模块: from blog.models import Entry [as 别名]
# 或者: from blog.models.Entry import popular_entries [as 别名]
def entry(request, id, slug):
entries = Entry.objects if request.user.is_superuser else Entry.live
try:
entry = entries.get(id=id)
except Entry.DoesNotExist:
raise Http404
if slug != entry.slug:
return HttpResponseRedirect(entry.get_absolute_url())
form = CommentForm(request)
if request.method == 'POST':
form = CommentForm(request, request.POST)
if form.is_valid():
comment = form.save_comment_for(entry)
return HttpResponseRedirect(_comment_url(request, comment))
return render(request,
'blog/entry.html',
{'item': entry,
'popular_entries': Entry.popular_entries(),
'form': form})