Пример #1
0
def author_detail(request, username, page=None):
    """Display the entries of an author"""
    author = get_object_or_404(Author, username=username)
    template_name = template_name_for_entry_queryset_filtered(
        'author', author.username)

    return object_list(request, queryset=author.entries_published_set(),
                       paginate_by=PAGINATION, page=page,
                       template_name=template_name,
                       extra_context={'author': author})
Пример #2
0
def tag_detail(request, tag, page=None, **kwargs):
    """Display the entries of a tag"""
    if not kwargs.get('template_name'):
        kwargs['template_name'] = template_name_for_entry_queryset_filtered(
            'tag', slugify(tag))

    return tagged_object_list(request, tag=tag,
                              queryset_or_model=Entry.published.all(),
                              paginate_by=PAGINATION, page=page,
                              **kwargs)
Пример #3
0
def category_detail(request, path, page=None):
    """Display the entries of a category"""
    category = get_category_or_404(path)
    template_name = template_name_for_entry_queryset_filtered(
        'category', category.slug)

    return object_list(request, queryset=category.entries_published_set(),
                       paginate_by=PAGINATION, page=page,
                       template_name=template_name,
                       extra_context={'category': category})
Пример #4
0
def tag_detail(request, tag, page=None):
    """Display the entries of a tag"""
    template_name = template_name_for_entry_queryset_filtered('tag', tag)

    return tagged_object_list(request,
                              tag=tag,
                              queryset_or_model=Entry.published.all(),
                              paginate_by=PAGINATION,
                              page=page,
                              template_name=template_name)
Пример #5
0
def category_detail(request, path, page=None):
    """Display the entries of a category"""
    category = get_category_or_404(path)
    template_name = template_name_for_entry_queryset_filtered(
        'category', category.slug)

    return object_list(request,
                       queryset=category.entries_published_set(),
                       paginate_by=PAGINATION,
                       page=page,
                       template_name=template_name,
                       extra_context={'category': category})
Пример #6
0
def author_detail(request, username, page=None, **kwargs):
    """Display the entries of an author"""
    extra_context = kwargs.pop("extra_context", {})

    author = get_object_or_404(Author, username=username)
    if not kwargs.get("template_name"):
        kwargs["template_name"] = template_name_for_entry_queryset_filtered("author", author.username)

    extra_context.update({"author": author})
    kwargs["extra_context"] = extra_context

    return object_list(request, queryset=author.entries_published_set(), paginate_by=PAGINATION, page=page, **kwargs)
Пример #7
0
def category_detail(request, path, page=None, **kwargs):
    """Display the entries of a category"""
    extra_context = kwargs.pop('extra_context', {})

    category = get_category_or_404(path)
    if not kwargs.get('template_name'):
        kwargs['template_name'] = template_name_for_entry_queryset_filtered(
            'category', category.slug)

    extra_context.update({'category': category})
    kwargs['extra_context'] = extra_context

    return object_list(request, queryset=category.entries_published_set(),
                       paginate_by=PAGINATION, page=page,
                       **kwargs)
Пример #8
0
def category_detail(request, path, page=None, **kwargs):
    """Display the entries of a category"""
    extra_context = kwargs.pop('extra_context', {})

    category = get_category_or_404(path)
    if not kwargs.get('template_name'):
        kwargs['template_name'] = template_name_for_entry_queryset_filtered(
            'category', category.slug)

    extra_context.update({'category': category})
    kwargs['extra_context'] = extra_context

    return object_list(request, queryset=category.entries_published(),
                       paginate_by=PAGINATION, page=page,
                       **kwargs)
Пример #9
0
def author_detail(request, username, page=None, **kwargs):
    """Display the entries of an author"""
    extra_context = kwargs.pop('extra_context', {})

    author = get_object_or_404(Author, username=username)
    if not kwargs.get('template_name'):
        # populate the template_name if not provided in kwargs.
        kwargs['template_name'] = template_name_for_entry_queryset_filtered(
                                  'author', author.username)

    extra_context.update({'author': author})
    kwargs['extra_context'] = extra_context

    return object_list(request, queryset=author.entries_published_set(),
                       paginate_by=PAGINATION, page=page,
                       **kwargs)