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


Python Submission.allows_listing_hidden_by方法代码示例

本文整理汇总了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
开发者ID:kyoshino,项目名称:kuma,代码行数:9,代码来源:views.py

示例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') 
开发者ID:lmorchard,项目名称:mdn,代码行数:21,代码来源:views.py

示例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')
开发者ID:BPaske,项目名称:kuma,代码行数:13,代码来源:views.py


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