Exemple #1
0
def tales(request, **kwargs):
    """List of tales"""
    sort = Sorting(request, sort_fields)
    queryset = Tale.objects.order_by(sort.get_order_by(), 'title')
    kwargs['queryset'] = queryset.filter(display=True).defer('text')
    kwargs['paginate_by'] = settings.PAGINATE_BY
    kwargs['extra_context'] = {
        'sort': sort.get_sorting(),
        'query_dict': request.GET.copy()
    }
    return object_list(request, **kwargs)
Exemple #2
0
def tag_tales(request, tag_name, **kwargs):
    """Tales list for tag"""
    tag = get_object_or_404(Tag, name=tag_name, tales_cnt__gt=0)
    sort = Sorting(request, sort_fields)
    queryset = tag.tales.order_by(sort.get_order_by(), 'title')
    kwargs['queryset'] = queryset.filter(display=True).defer('text')
    kwargs['paginate_by'] = settings.PAGINATE_BY
    kwargs['template_name'] = 'tales/tag_tales_list.html'
    kwargs['extra_context'] = {
        'sort': sort.get_sorting(),
        'tag': tag,
        'query_dict': request.GET.copy()
    }
    return object_list(request, **kwargs)