本文整理汇总了Python中demos.models.Submission.allows_listing_hidden_by方法的典型用法代码示例。如果您正苦于以下问题:Python Submission.allows_listing_hidden_by方法的具体用法?Python Submission.allows_listing_hidden_by怎么用?Python Submission.allows_listing_hidden_by使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类demos.models.Submission
的用法示例。
在下文中一共展示了Submission.allows_listing_hidden_by方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_queryset
# 需要导入模块: from demos.models import Submission [as 别名]
# 或者: from demos.models.Submission import allows_listing_hidden_by [as 别名]
def get_queryset(self):
submissions = Submission.objects.all_sorted(
self.request.GET.get('sort', 'created')
)
if not Submission.allows_listing_hidden_by(self.request.user):
submissions = submissions.exclude(hidden=True)
return submissions
示例2: home
# 需要导入模块: from demos.models import Submission [as 别名]
# 或者: from demos.models.Submission import allows_listing_hidden_by [as 别名]
def home(request):
"""Home page."""
featured_submissions = Submission.objects.order_by('-modified').filter(featured=True)
if not Submission.allows_listing_hidden_by(request.user):
featured_submissions = featured_submissions.exclude(hidden=True)
submissions = Submission.objects.all_sorted(request.GET.get('sort', 'created'))
if not Submission.allows_listing_hidden_by(request.user):
submissions = submissions.exclude(hidden=True)
return object_list(request, submissions,
extra_context={
'featured_submission_list': featured_submissions,
},
paginate_by=DEMOS_PAGE_SIZE, allow_empty=True,
template_loader=template_loader,
template_object_name='submission',
template_name='demos/home.html')
示例3: all
# 需要导入模块: from demos.models import Submission [as 别名]
# 或者: from demos.models.Submission import allows_listing_hidden_by [as 别名]
def all(request):
"""Browse all demo submissions"""
sort_order = request.GET.get('sort', 'created')
queryset = Submission.objects.all_sorted(sort_order)
if not Submission.allows_listing_hidden_by(request.user):
queryset = queryset.exclude(hidden=True)
return object_list(request, queryset,
paginate_by=DEMOS_PAGE_SIZE, allow_empty=True,
template_loader=template_loader,
template_object_name='submission',
template_name='demos/listing_all.html')