def version_list(request, product): kwargs = { 'queryset': Version.objects.filter(product=product), 'extra_context': { 'product': product, } } return list_detail.object_list(request, **kwargs)
def component_list(request, product): kwargs = { 'queryset': Component.objects.filter(product=product), 'extra_context': { 'product': product, } } return list_detail.object_list(request, **kwargs)
def tweet_list(request, author=None): kwargs = { 'queryset': Tweet.objects.all() if not author else Tweet.objects.filter(author=author), 'paginate_by': settings.DEFAULT_TIMELINE_LENGTH, 'extra_context': { 'author': author, }, } return list_detail.object_list(request, **kwargs)
def tweet_favorite_list(request, author=None, order_by='new', threshold=3): qs = Tweet.objects.annotate(favorite_users=Count('users')) # Author filter if author: qs = qs.filter(author=author) # Threshold filter qs = qs.filter(favorite_users__gte=threshold) # Order by if order_by == 'popular': qs = qs.order_by('-favorite_users', '-created_at') elif order_by == 'new': qs = qs.order_by('-created_at', '-favorite_users') kwargs = { 'queryset': qs, 'template_name': r'tweets/tweet_favorite_list.html', 'extra_context': { 'author': author, 'threshold': threshold, 'order_by': order_by, } } return list_detail.object_list(request, **kwargs)
def announcement_list(request): kwargs = {"queryset": Announcement.objects.published(request), "paginate_by": 200} return list_detail.object_list(request, **kwargs)
def product_list(request): kwargs = { 'queryset': Product.objects.all(), } return list_detail.object_list(request, **kwargs)
def flatpage_list(request): kwargs = { 'queryset': FlatPage.objects.all(), } return list_detail.object_list(request, **kwargs)
def permissiongroup_list(request): kwargs = { 'queryset': models.PermissionGroup.objects.all(), } return list_detail.object_list(request, **kwargs)