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})
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)
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})
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)
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)
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)
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)
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)