Ejemplo n.º 1
0
def version_list(request, product):
    kwargs = {
        'queryset': Version.objects.filter(product=product),
        'extra_context': {
            'product': product,
        }
    }
    return list_detail.object_list(request, **kwargs)
Ejemplo n.º 2
0
def component_list(request, product):
    kwargs = {
        'queryset': Component.objects.filter(product=product),
        'extra_context': {
            'product': product,
        }
    }
    return list_detail.object_list(request, **kwargs)
Ejemplo n.º 3
0
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)
Ejemplo n.º 4
0
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)
Ejemplo n.º 5
0
def announcement_list(request):
    kwargs = {"queryset": Announcement.objects.published(request), "paginate_by": 200}
    return list_detail.object_list(request, **kwargs)
Ejemplo n.º 6
0
def product_list(request):
    kwargs = {
        'queryset': Product.objects.all(),
    }
    return list_detail.object_list(request, **kwargs)
Ejemplo n.º 7
0
def flatpage_list(request):
    kwargs = {
        'queryset': FlatPage.objects.all(),
    }
    return list_detail.object_list(request, **kwargs)
Ejemplo n.º 8
0
def permissiongroup_list(request):
    kwargs = {
        'queryset': models.PermissionGroup.objects.all(),
    }
    return list_detail.object_list(request, **kwargs)